I'm trying to implement XamDataGrid column visibilty in a MVVM architecture and it does not seems to be working.
I'm doing the following:
Adding Visiblility property for an unbound 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 proerty of Visibility type:
//ToShow CustomerID Column
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");
Anybody with a solution?
Cheers, Anshuman