none
Binding GridViewHeaderRowPresenter with Header from DataTable, Custom Control

    Question

  • 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">

    <Setter.Value>

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

    <Grid>

    <Grid.RowDefinitions>

    <RowDefinition Height="30"/>

    <RowDefinition />

    </Grid.RowDefinitions>

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

    <GridViewHeaderRowPresenter/>

    </UniformGrid>

    <ItemsPresenter Grid.Row="1"/>

    </Grid>

    </ControlTemplate>

    </Setter.Value>

    </Setter>

    </Style>

    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,
    Franklin.

     

    Thursday, June 12, 2008 1:48 PM

Answers