I am trying to implement a XamDataGrid visibilty column in MVVM architecture and it does not seem to work.
I do the following:
Adding the Visiblility property for an unrelated field -
<igDP:UnboundField Name="gridCustomerId"
Label="ID"
Binding="{Binding customerid,
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding ShowCustomerIDColumn,
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}">
In my view model, adding a proprietary visibility type:
private Visibility showCustomerIDColumn;
public Visibility ShowCustomerIDColumn
{
get
{
return showCustomerIDColumn;
}
set
{
showCustomerIDColumn=value;
InvokePropertyChanged("ShowCustomerIDColumn");
}
}
Then in the command handler using the following code:
if(ShowCustomerIDColumn == Visibility.Hidden)
ShowCustomerIDColumn = Visibility.Visible;
else
ShowCustomerIDColumn = Visibility.Hidden;
InvokePropertyChanged("ShowCustomerIDColumn");
Anyone with a solution?
Cheers, Anshuman
source
share