i am trying to bind my image’s source property into a StorageFile
But it’s failing.
i don’t know what’s wrong but here is the XAML code:
<Style x:Key="SearchListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="0" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate DataType="model:DatabaseItem" >
<Border BorderThickness="0,0,0,1" BorderBrush="#e9e9e9" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="80">
<Grid>
<!-- The following Image is the concerned. -->
<Image Width="93" Height="61" Margin="12,0,0,0" VerticalAlignment="Center" Source="{Binding StorageFile}"
Stretch="UniformToFill" HorizontalAlignment="Left" />
<TextBlock Text="{Binding Name}" Margin="115,15,0,0" Foreground="#787878" FontFamily="Arial"
FontSize="12" FontWeight="Bold" VerticalAlignment="Top" HorizontalAlignment="Left"/>
<TextBlock Text="{Binding Author}" Margin="115,34,0,0" FontFamily="Arial" FontSize="12" FontWeight="Bold"
Foreground="{Binding Installed, Converter={StaticResource InstalledByColorConverter}}"
VerticalAlignment="Top" HorizontalAlignment="Left" />
</Grid>
</Border>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
StorageFile
property is defined in the model:DatabaseItem
Class.
public StorageFile StorageFile {
get
{
return _StorageFile;
}
set
{
StorageFile = value;
OnPropertyChanged("StorageFile");
}
}