Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
205
How to access DataRecordCellAreaGridTemplate in codebehind
posted

Hi,

I have a xamdatagrid with few columns, I have put ToggleButton in one column header , when you click on the ToggleButton, it expands and It shows 6 columns which were there in Collapsed state. they become visible. similarly when you click it once again, 6 expanded columns are collapsed again.

Column which has toggle button on; it is marked bold in below xaml,

and is displayed with rowspan=2 & row=0, columns with width=200 & 20 are always displayed when 6 columns are expanded they are displayed in last, when 6 columns are collapsed then these 2 columns are displayed after the column which is marked in bold.

 <igDP:FieldLayoutSettings.DataRecordCellAreaGridTemplate

>

 

 

 

 

<ItemsPanelTemplate

>

 

 

 

 

<Grid x:Name

="gridDataRecordCellAreaGridTemplate">

 

 

 

 

<Grid.ColumnDefinitions

>

 

 

 

 

<ColumnDefinition Width

="80"/>

 

 

 

 

<ColumnDefinition Width

="250"/>

 

 

 

 

<ColumnDefinition Width

="50"/>

 

 

 

 

<ColumnDefinition Width

="50"/>

 

 

 

 

<ColumnDefinition Width

="50"/>

 

 

 

 

<ColumnDefinition Width

="50"/>

 

 

 

 

<ColumnDefinition Width

="50"/>

 

 

 

 

<ColumnDefinition Width

="50"/>

 

 

 

 

<ColumnDefinition Width

="50"/>

 

 

 

 

<ColumnDefinition Width

="200"/>

 

 

 

 

<ColumnDefinition Width

="20"/>

 

 

 

 

</Grid.ColumnDefinitions

>

 

 

 

 

</Grid

>

 

 

 

 

</ItemsPanelTemplate

>

 

 

 

 

</igDP:FieldLayoutSettings.DataRecordCellAreaGridTemplate

>

 

 

Now, my problem is I want to set Column Width for each and every column, so i used DataRecordCellAreaGridTemplate, i have put  ComunDefinitions for all columns, but when 6 columns are collapsed, how can I maintain the same column width i.e. 200 & 20. what happens it these 2 column are displayed with width = 50!

Please give me some solution, how can we handle the column width, some style or my guess is we can do that in code behind, i have a function named "ToggleButtonPressed" which does this job of expanding & collapsing, we could add some code there, but i dont know how to access DataRecordCellAreaGridTemplate in code behind.

Parents
  • 69686
    Verified Answer
    posted

    Hello,

    You can access that Grid element using the Infragistics.Utilities.GetAncestorFromName/ GetDescendantFromName methods as you have specified a name already. Another way to do this, without the DataRecordCellAreaGridTemplate is by setting CellWidth and LabelWidth properties of the Fields in the FieldLayout.

Reply Children