Hi,
After Grouping Silverlight XAMGrid by one column, While using xamGrid GroupByrow (by 1 column), for the second 2nd Group, the Control property is always null. I am using following code to change focus from Hour textbox to minute textbox once 2 digits are entered in hours textbox.
Probem: Following is always null for 2nd Group in xamGrid GroupByrow. For 1st Group its returns controls on the Cell.
((Infragistics.Controls.Grids.Primitives.GroupByRow)(xamGrid.Rows[0])).Cells[5].Control
C# Code:
StackPanel sp = ((TUdgTargetTSSearchResults.Rows[currRow].Cells[5].Control) as ContentControl).Content as StackPanel;
XamNumericEditor item2 = sp.Children[2] as XamNumericEditor;
item2.Focus();
XAML:
<ig:TemplateColumn Key="MyTime" HeaderText="Idea Time" IsSummable="False" MinimumWidth="80" MaximumWidth="320" Width="Auto" IsSortable="False" IsGroupable="False" IsHideable="False">
<ig:TemplateColumn.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="3,5,3,5" DataContext="{Binding}" >
<sdk:DatePicker
x:Name="MyDate"
Grid.Row="0" Width="100"
Margin="3,0,10,0"
BorderBrush="DeepSkyBlue"
DisplayDate="{Binding Path=MyDate}"
SelectedDate="{Binding Path=IdeaDate, Mode=TwoWay}"
Visibility="Collapsed"
Loaded="MyDate_Loaded"
/>
<ig:XamNumericEditor x:Name="MyHour" Width="30" Margin="0,0,5,0" Mask="{}{double:-2.0}" Value="{Binding MyHour, Mode=TwoWay, UpdateSourceTrigger=Explicit, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" Tag="MyHour" GotFocus="XamNumericEditor_GotFocus" LostFocus="XamNumericEditor_LostFocus" KeyUp="MyHour_KeyUp" KeyDown="MyHour_KeyDown_1"/>
<ig:XamNumericEditor x:Name="MyMinute" Width="30" Margin="0,0,5,0" Mask="{}{double:-2.0}" Value="{Binding MyMinute, Mode=TwoWay, UpdateSourceTrigger=Explicit, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" Tag="MyMinute" GotFocus="XamNumericEditor_GotFocus" LostFocus="XamNumericEditor_LostFocus" KeyUp="MyMinute_KeyUp" />
<ig:XamNumericEditor x:Name="MySecond" Width="30" Margin="0,0,5,0" Mask="{}{double:-2.0}" Value="{Binding MySecond, Mode=TwoWay, UpdateSourceTrigger=Explicit, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" Tag="MySecond" GotFocus="XamNumericEditor_GotFocus" LostFocus="XamNumericEditor_LostFocus" KeyUp="MySecond_KeyUp" KeyDown="MySecond_KeyDown"/>
</StackPanel>
</DataTemplate>
</ig:TemplateColumn.ItemTemplate>
Can you please reply quickly ?
waiting for response
Hello shaktishekhar,
If you references a GroupByRow cell collection when you group by only one column, you actually have only one cell control. In order to access the contained rows within the groupByRecord you can try the following snippet:
((Infragistics.Controls.Grids.Primitives.GroupByRow)(xamGrid.Rows[0])).Rows[0].Cells[1].Control.ToString();
Also please notice that the Control property of the Cells will be null if the cell that you are trying to access isn’t currently in view.
If I have misunderstood you in any way would you please provide me with a screenshot where the control that you are trying to access is highlighted.
Thank you.
Hi Elena,
I will try and get back to you.
Thanks,
Shakti
Hello Shakti,
XamGrid virtualize its cells, so only the CellContols that are currently in view are not null. For example in my snippet Control will not be null only if you have expanded the first group by row, and the second cell from its first child row is currently visible:
((Infragistics.Controls.Grids.Primitives.GroupByRow)(dtgPersons.Rows[0])).Rows[0].Cells[1].Control
Furthermore you can get the current active row as follows:
dtgPersons.ActiveCell.Row.Index (in your case this will return 1)
and you can get the index of its parent group by row as follows:
dtgPersons.ActiveCell.Row.Manager.ParentRow.Index , which will return 11 in the particular scenario from the screenshot.
Based on this you can achieve currently selected Time cell as follows:
((Infragistics.Controls.Grids.Primitives.GroupByRow)(dtgPersons.Rows[11])).Rows[1].Cells[4].Control
Please let me know if you need any additional information on this matter.