XAML code:
<ListView x:Name="Toolbar" Grid.Row="1" ItemsSource="{Binding List}">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel MouseLeftButtonDown="Lamp_Click" Name="Lamp" Background="White" Width="34" Height="35">
<Grid Height="30">
<Image Source="images/{Binding Path}">
</Image>
<TextBlock Text="{Binding Name}" FontSize="7" TextAlignment="Center" Margin="-1,19,1,-12"></TextBlock>
</Grid>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
C# code:
public class MyClass
{
public static List<ViewModel> List{ get; set; } = GetAll();
public static List<ViewModel> GetAll()
{
// get records from data base.
}
}
This code has syntax error. How can I change images/{Binding path} to a valid. why this code has error? I'm really confused. Please help me.