Jump to content

Manually Assign a Resource WPF

- - - - -

  • Please log in to reply
No replies to this topic

#1
sp3tsnaz

sp3tsnaz

    Learning Programmer

  • Members
  • PipPipPip
  • 41 posts
I want to assign ColumnHeaderTemplate="{StaticResource OrangeHeaderTemplate}" through code in c#. Please see the code below!! Is it possible .. if yes how ?


<Window.Resources>       
    <DataTemplate x:Key="OrangeHeaderTemplate">
        <DockPanel>
            <CheckBox/>
            <TextBlock FontSize="10" Foreground="Orange"
                       FontWeight="Bold" >
      <TextBlock.Text>
        <Binding/>
      </TextBlock.Text>
            </TextBlock>
        </DockPanel>
    </DataTemplate>   
</Window.Resources>

The code snippet sets the ColumnHeaderTemplate of a GridView.
<GridView AllowsColumnReorder="true" ColumnHeaderToolTip="Authors"
          ColumnHeaderTemplate="{StaticResource OrangeHeaderTemplate}" >





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users