Hi,
we are using XAM grid in our application, we want that, as we select a particular header we want to get this particular text header and field value.
<ig:XamGrid x:Name="grduser" AutoGenerateColumns="false" ItemsSource="{Binding Path=Userdata}" ColumnWidth="200" Grid.Row="1" > <ig:XamGrid.EditingSettings> <ig:EditingSettings AllowEditing="Row" /> </ig:XamGrid.EditingSettings> <ig:XamGrid.SelectionSettings> <ig:SelectionSettings CellClickAction="SelectRow" RowSelection="Single" /> </ig:XamGrid.SelectionSettings> <ig:XamGrid.RowSelectorSettings> <ig:RowSelectorSettings Visibility="Hidden"></ig:RowSelectorSettings> </ig:XamGrid.RowSelectorSettings> <ig:XamGrid.Columns> <ig:TextColumn Key="User_Name" HeaderText="User Name" Width="100"> <ig:TextColumn.HeaderTemplate> <DataTemplate> <TextBlock Text="Name" /> </DataTemplate> </ig:TextColumn.HeaderTemplate> </ig:TextColumn> </ig:XamGrid.Columns> </ig:XamGrid>
in above example, as we select the header of User Name, we want to get header text and key value of header.
Please let us suggest for that.
Thanks
Hi Pri,
Thank you for your reply. You need to add the style in the resources of your windows e.g. I am attaching a sample application(xamGridHeaderClick.zip) which shows that.
Let me know, if you need any further assistance on this matter.
Thanks for your reply, But where should I have to add this style for headerCellControl, Because as I add the style on page
<Style TargetType="ig:HeaderCellControl">
<EventSetter Event="MouseLeftButtonDown" Handler="ColumnHeader_MouseLeftButtonDown"/>
</Style>
Warning shows that: TargetType HeaderCell control does not exist in the namespace: http://schemas.infragistics.com/xaml
Thank you for your post. I have been looking into your requirement and you can handle the ‘MouseLeftButtonDown’ event of the HeaderCellControl using event handler:
<Style TargetType="igPrim:HeaderCellControl">
private void ColumnHeader_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
string key = (sender as HeaderCellControl).Column.Key;
string text = (sender as HeaderCellControl).Column.HeaderText;
}