Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

  • Nisarg More

    Nisarg More

    Member

    4 Points

    2 Posts

    Re: How to access resources inside a data template?

    Sep 20, 2011 09:55 AM | LINK

    Hey Jonathan Just Tell Me How to Find Control inside Of DataGrid Header Column

    Here is My XAML Code

    <navigation:Page x:Class="CheckBoxDemo.Views.MyPages.CheckBoxDemo"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"

    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"

    xmlns:dg="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"

    d:DesignWidth="640" d:DesignHeight="480"

    xmlns:dataprimitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Data"

    Title="CheckBoxDemo Page" Loaded="Page_Loaded">

    <dg:DataGridTemplateColumn Width="auto">

    <dg:DataGridTemplateColumn.HeaderStyle>

    <Style TargetType="dataprimitives:DataGridColumnHeader">

    <Setter Property="ContentTemplate">

    <Setter.Value>

    <DataTemplate>

    <CheckBox Content="Select Location" IsChecked="{Binding IsSelected, Mode=TwoWay}" x:Name="chkSelectAll" Checked="chkSelectAll_Checked" Unchecked="chkSelectAll_Unchecked"></CheckBox>

    </DataTemplate>

    </Setter.Value>

    </Setter>

    </Style>

    </dg:DataGridTemplateColumn.HeaderStyle>

    <dg:DataGridTemplateColumn.CellEditingTemplate>

    <DataTemplate>

    <CheckBox x:Name="chksSelected" IsChecked="{Binding IsSelected, Mode=TwoWay}" Width="100"VerticalAlignment="Center"/>

    </DataTemplate>

    </dg:DataGridTemplateColumn.CellEditingTemplate>

    </dg:DataGridTemplateColumn>

    Now i want to UnCheck that CheckBox located in DataGrid Header on Click Of Button How i can Achieve these Functionality

    Any Help Would Be Appreciated