My search contract basically looks at an SQLite database, and returns the relevant records. These records are then manipulated so that the appropriate information is available for display and selection on the search charm page. However, I a results corresponding image to display with the result (following the default search contract result template)
The image is stored as a string in my CustomObjectRecord database. When the record is selected it is converted to a CustomObject, and the image string saved in the CustomObjectRecord is converted to a Bitmap object called searchImage. I want this to be displayed with my results, but when the search charm returns I get an error on the output console
Error: BindingExpression path error: 'searchImage' property not found on 'My_App.Classes.CustomObject, My App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. BindingExpression: Path='searchImage' DataItem='My_App.Classes.CustomObject, My App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'; target element is 'Windows.UI.Xaml.Controls.Image' (Name='thumbImage'); target property is 'Source' (type 'ImageSource')
The template definition
<DataTemplate x:Key="LocalStandardSmallIcon300x70ItemTemplate">
<Grid Width="294" Margin="6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}" Margin="0,0,0,10" Width="40" Height="40">
<Image Name="thumbImage" Source="{Binding searchImage}" Stretch="UniformToFill"/>
</Border>
<StackPanel Grid.Column="1" Margin="10,-10,0,0">
<TextBlock Text="{Binding Name}" Style="{StaticResource BodyTextStyle}" TextWrapping="NoWrap"/>
</StackPanel>
</Grid>
</DataTemplate>
searchImage is defined in CustomObject as
public Bitmap searchImage;
The searchImage property of my CustomObject is set when the record is loaded from the database. The Name binding in the same template works fine.
Any pointers would be great.
If any more code is required please let me know.
Got it, it was simply a case of including
{ get; set; }on thesearchImagedefinition…