I created an Account class.
Then I created another ReorderWindowController class that has a SelectedAccount field / property of type Account .
Finally, I wrote a ReorderWindow WPF window ReorderWindow file:
<Window ... <Window.Resources> <contollers:ReorderWindowController x:Key="WindowController" /> <DataTemplate DataType="{x:Type entities:Account}"> <Grid Width="140" Height="50" Margin="5"> <TextBlock Text="Some awesome text" /> <TextBlock Text="{Binding Name}" /> <TextBlock Text="Even more awesome text" /> </Grid> </DataTemplate> </Window.Resources> <Grid> <Grid Name="AccountGrid" DataContext="{Binding Source={StaticResource ResourceKey=WindowController}, Path=SelectedAccount}"> </Grid> </Grid> </Window>
When I run my code, AccountGrid nothing. What for? How to bind object data to a Grid and how can I use my data template? Thank you
Boris source share