I have small problem.
Code behind:
...
public struct Project
{
string Name;
string Path;
public Project(string Name, string Path = "")
{
this.Name = Name;
this.Path = Path;
}
}
...
Resources code:
<DataTemplate x:Key="ItemProjectTemplate">
<StackPanel>
<Image Source="Assets/project.png" Width="50" Height="50" />
<TextBlock FontSize="22" Text="{Binding Name}" />
</StackPanel>
</DataTemplate>
Normal code in Grid:
<ListView Grid.Column="1" HorizontalAlignment="Left" Height="511"
Margin="25,72,0,0" Grid.Row="1" VerticalAlignment="Top" Width="423"
x:Name="Projects" ItemTemplate="{StaticResource ItemProjectTemplate}" />
I have no problem with ListView source, which is being set in C# code, and also my template is being loaded. But this happens when I’m running my application:

As you can see the project name (Project.Name) is not being displayed, but in my ListView template is data binding, so it should work. Does anybody know why is my data binding for a text not working? Please help.
DataBindingworks forPropertiesand not onFields. Replace Struct with class and make your fields as properties-