Binding GridViewHeaderRowPresenter with Header from DataTable, Custom Control


  • Hi,

    I'm writing a custom control for a ListView. The Strip down version of the Style with control template for the Custom ListView as follows:

    <Style x:Key="{ComponentResourceKey local:SampleListView, SampleListViewStyle}"

    TargetType="{x:Type local:SampleListView}" >

    <Setter Property="Template">


    <ControlTemplate TargetType="{x:Type local:SampleListView}">



    <RowDefinition Height="30"/>

    <RowDefinition />


    <UniformGrid x:Name="ugWrapHeader" Rows="1" Grid.Row="0" Background="Red" HorizontalAlignment="Left" Margin="1,0,0,0">



    <ItemsPresenter Grid.Row="1"/>






    I'm assigning the ItemsSource of the SampleListView to a DataTable.DefaultView. The Data Row values are displayed but with Blank Headers, Since I'm using  GridViewHeaderRowPresenter for my Header, just a blank Header strip is display. I need to bind the GridViewHeaderRowPresenter to the actual Columns Names in the DataTable. I need my Custom ListView to be able to Generate its Headers from the DataTable that is assigned from the Client. How do we acheive this?

    Thank you,


    Thursday, June 12, 2008 1:48 PM