I am using WPF with .NET 3.0.
I have a relatively simple DataTemplate defined as a CellTemplate for a GridView. I expect the VisualTree DataTemplate property to contain FrameworkElementFactory, but the property is null when I try to access it from the GridViewColumnHeader.Click event. Why is VisualTree null? I need to access it. Here is the definition of a ListView:
<ListView ItemsSource="{Binding Stuff}" GridViewColumnHeader.Click="Header_Click"> <ListView.View> <GridView> <GridViewColumn Width="28"> <GridViewColumn.CellTemplate> <DataTemplate> <Image Name="statusImage" Width="16" Height="16" Source="../Images/media_play_green_16x16.png"/> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> </GridView> </ListView.View> </ListView>
And here is the event handler:
private void Header_Click(object sender, RoutedEventArgs e) { GridViewColumnHeader gvch = e.OriginalSource as GridViewColumnHeader;
source share