Note that there are some explanatory texts on larger screens.

plurals
  1. POPopulating search contract results with images
    primarykey
    data
    text
    <p>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)</p> <p>The image is stored as a string in my <code>CustomObjectRecord</code> database. When the record is selected it is converted to a <code>CustomObject</code>, and the image string saved in the <code>CustomObjectRecord</code> is converted to a Bitmap object called <code>searchImage</code>. I want this to be displayed with my results, but when the search charm returns I get an error on the output console</p> <p><code>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')</code></p> <p>The template definition</p> <pre><code>&lt;DataTemplate x:Key="LocalStandardSmallIcon300x70ItemTemplate"&gt; &lt;Grid Width="294" Margin="6"&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="Auto"/&gt; &lt;ColumnDefinition Width="*"/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}" Margin="0,0,0,10" Width="40" Height="40"&gt; &lt;Image Name="thumbImage" Source="{Binding searchImage}" Stretch="UniformToFill"/&gt; &lt;/Border&gt; &lt;StackPanel Grid.Column="1" Margin="10,-10,0,0"&gt; &lt;TextBlock Text="{Binding Name}" Style="{StaticResource BodyTextStyle}" TextWrapping="NoWrap"/&gt; &lt;/StackPanel&gt; &lt;/Grid&gt; &lt;/DataTemplate&gt; </code></pre> <p><code>searchImage</code> is defined in CustomObject as</p> <pre><code> public Bitmap searchImage; </code></pre> <p>The <code>searchImage</code> property of my CustomObject is set when the record is loaded from the database. The Name binding in the same template works fine.</p> <p>Any pointers would be great. If any more code is required please let me know.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload