we have an xamGrid, and set AllowAddNewRow="Bottom", then we can add new row.
however, the system is logined based on different role, how can i hidden the "NewRow" visibility when user who just has read priviledge? we use the MVVM pattern.
thanks.
Hi,
you could hide the AddNewRow by setting the AllowAddnewRow to None. Regarding the MVVM aproach you're using - you could easily bind this prop to your ViewModel class(probably a converter will be required).
HTH,
Attached a small sample demonstrating the approach described by Konstantin.
Hope this helps,
The short answer is "Yes" - you can change dinamically the AllowAddNewRow property to control the visibility/location of the Add New Row.
I believe there is a button in the attached sample that does exactly what you're looking for. It updates the property in the ViewModel and as a result - the visibility of the Add New Row is updated accordingly. Is it not working in your case ? Did you implement INotifyPropertyChanged on your ViewModel, so the bindings are correctly updated upon property change?
hi Georgi , hope you can hlep me. thanks.
The AddNewRowSettings object is not a FrameworkElement, so it does not participate in DataContext inheritance. Such objects cannot participate in DataContext or ElementName bindings in XAML. You can only bind it to a Static Resource from XAML. The other option is to set the binding from code-behind. I modified your sample to demonstrate how to do that.
dear Georgi, you are so so so great! you help me too much!!! very very thanks to you...
Glad to see I was able to help :-)