You can use a converter to calculate the visibility of the Image.
Declare a converter like that, implement your logic
class ObjectToVisibilityConverter: IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
bool someCondition;
// Cast value to the right class, and write the logic to set someCondition
[...]
return someCondition ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
Referece ObjectToVisibilityConverter in your Page.Resources
<Page.Resources>
<converters:ObjectToVisibilityConverter x:Key="ObjectToVisibilityConverter"/>
</Page.Resources>
use the converter with Image
<Image Grid.Column="2" Source="Assets/Images/Other/SquashedySmiley_7.png" Visibility="{Binding Converter={StaticResource ObjectToVisibilityConverter}}">
<Image.RenderTransform>
<CompositeTransform ScaleX=" .9" ScaleY=" .9"/>
</Image.RenderTransform>
</Image>