Hi,
I want to dosomething like on XamDataGridFieldLayoutSettings :
AllowAddNew="{Binding MyBoolValue, Converter={StaticResource InvertBoolToBoolConverter}}"
but it's not work (it's work on IsEnabled property of an XamTextEditor on same user control)
An issue ? Thanks
Hello,
When binding a property from FieldLayoutSettings and FieldSettings collections the difference is that the properties are not in the visual tree and therefore need their source explicitly set like so:
<igDP:XamDataGrid.FieldLayoutSettings >
<igDP:FieldLayoutSettings AddNewRecordLocation="OnBottom" >
<igDP:FieldLayoutSettings.AllowAddNew>
<Binding Path="AllowAddNewProperty" Source="{StaticResource VM}" />
</igDP:FieldLayoutSettings.AllowAddNew>
</igDP:FieldLayoutSettings>
</igDP:XamDataGrid.FieldLayoutSettings>
In this case I have used a ViewModel approach intanciated like so:
<Window.Resources>
<local:MainViewModel x:Key="VM" />
</Window.Resources>
Hope this is what you needed.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support
Thanks,
But I want to Bind on a currentItem on view with in a observablecollection in usercontrol datacontext.
My value is MyObservableCollection/MyBool and a converter is use too ...
It doesn't work ! Thanks
This is what I mean - you can't use the DataContext you have provided for the user control or even the XamDataGrid because the FieldLayoutSettings collection is in a different visual tree. That is why you have to instantiate the DataContext you have given the uset control (in my case VM) and make a binding using the same instance of the DataContext as source.
Hope this makes things clearer.
Kind regards Petar.
Hi Peter,
I tried following the viewmodel approach which you mentioned here . I see that they (AllowAddNew and AllowDelete ) are able to bind to the properties of the corresponding viewmodel (checked in debug mode) but I don't see that change being reflected onto the UI ?
When I set the property values to True ( from my application ) , I dont see the + sign for adding new nor the ability to delete a record ( though the value is set to True).
Looking for your reply.
Srikanth