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,
billion thanks, Georgi.
but there is a question, can we dynamically change the "AllowAddNewRow" property? i mean if there is a button, Readonly or Edit, then it can be controled by the button instead of at the begining of the user login to it.
i tried in my local, it seems failed. is it ok in your side?
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?
Glad to see I was able to help :-)
dear Georgi, you are so so so great! you help me too much!!! very very thanks to you...
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.
hi Georgi , hope you can hlep me. thanks.
Dear Georgi, sorry to trouble u again.
Yes, you demo is right. but that is based on key template. If the DataContext comes from the Dependency(using Microsoft.Practices.Unity) or just like my attached file(assign value in the View's constructor), when i click the "Show Me" button(User control SilverlightControl1), there is no change on the grid's "AllowAddNewRow". can you help me?
my Infragistics Silverlight control's version is 10.3, will it affect?