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
55
XamDataGrid, Collapsing a column based on a visibility value
posted

Hi,

I have already seen a few examples about this issue. But i am not able to correlate to my problem. Please help me in doing it.

My problem is that i have a datagrid with two fields and i want to collapse one field based on a visibility value change in the code.

The XAML code part where i define the fields is as follows :

<igDP:XamDataGrid.FieldLayouts>

<igDP:FieldLayout>

<igDP:FieldLayout.Fields>

<igDP:Field Visibility="{Binding Source={StaticResource ViewModel}, Path=bRValidation_Display}" Name="BO" Label="BLine Operation" />

<igDP:Field Name="ROperation" Label="ROperation"/>

igDP:FieldLayout.Fields>

igDP:FieldLayout>

igDP:XamDataGrid.FieldLayouts>

and the resources is defined in the start as

<Grid.Resources>

<rvm:OViewerViewModel x:Key="ViewModel"/>

</Grid.Resources>

and rvm namespace is defined in the starting !!

 

the C# code where i define the visibility variable is

public Visibility bRValidation_Display

{

get { return

bVisibility; }

set

{

bVisibility =value;

NotifyPropertyChanged("bRValidation_Display");

}

This visibility value is set in the later part of the code . I tried to check the values using breakpoints and found that the visibility value of the BrValidation_Display when checked in the XAML code in the fields line during execution can be seen as collapsed . but the output window still shows the field in the grid without collapsing it . Is the value not binded properly or the problem is related to the visual tree. Where am i going wrong. Please provide me a way to correct this as well.

Parents Reply Children