I searched the documentation but apparently there is no PriorityBinding for Windows Phone 8. Is there a similar way to achieve the same behaviour in XAML in Windows Phone 8?
I've created a Style for a ListItem:
<DataTemplate x:Key="ListItem">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="50" />
</Grid.ColumnDefinitions>
<Image
Grid.Column="0"
Source="{Binding Path=ImageSource}" />
<TextBlock
Grid.Column="1"
TextWrapping="NoWrap"
TextTrimming="WordEllipsis"
Text="{Binding Path=Text}" />
<Image
Grid.Column="2"
Source="/images/arrow_right.png" />
</Grid>
</DataTemplate>
Now I want to add a PriorityBinding, so if the ImageSource or Text are empty I want to add placeholders.
I found this example for WPF:
<Image.Source>
<PriorityBinding FallbackValue="/images/default_category.png">
<Binding Path="ImageSource"/>
</PriorityBinding>
</Image.Source>
[...]
<TextBlock.Text>
<PriorityBinding FallbackValue="Placeholder Text">
<Binding Path="Text"/>
</PriorityBinding>
</TextBlock.Text>
I tried to add PriorityBinding to my ImageSource in the App.xaml and the following error occurs:
The type 'PriorityBinding' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.
Edit
I want to bind the ImageSource to the ImageSource property of my model, and if there is no data, then I want to use a placeholder as image instead of the (empty) ImageSource of my model.
The same goes for my TextBlock, if the text in my model is empty I want to display a placeholder text (e.g. "no data").
PriorityBinding
class yourself... – John Gardner