Hi,
I am sure I am doing something wrong, but I am not sure where (I am new to WPF). Like in the example provided, I am using the following code to fill my tree, but the selection binding does not work. I see the data record correctly as my selected object but the set on the SelectedObj is never called if my templateField is bound to another property than Name, like I tried in the snippet below with FullName.
Works great if the property is Name...
Any help on how to achieve my display to be FullName and get the selecteed object to set would be greatly appreciated!
Thanks,
Maria
<igDP:XamTreeGrid x:Name="xtgTest" DataSource="{Binding ListOfCatObj}" SelectedDataItem="{Binding SelectedObj, Mode=TwoWay}" >
<igDP:XamTreeGrid.FieldLayoutSettings >
<igDP:FieldLayoutSettings AutoGenerateFields="False" RecordSelectorLocation="None" SelectionTypeRecord="Single" LabelLocation="Hidden"/>
</igDP:XamTreeGrid.FieldLayoutSettings>
<igDP:XamTreeGrid.FieldLayouts>
<igDP:FieldLayout>
<igDP:TemplateField Name="FullName" Width="*" DataType="{x:Type sys:String}">
<!--<igDP:TemplateField Name="Name" Width="*" DataType="{x:Type sys:String}"> THIS works!!!-->
<igDP:TemplateField.DisplayTemplate>
<DataTemplate>
<TextBlock Text="{igEditors:TemplateEditorValueBinding}" />
</DataTemplate>
</igDP:TemplateField.DisplayTemplate>
</igDP:TemplateField>
<igDP:Field Name="ListOfBaseObject" />
</igDP:FieldLayout>
</igDP:XamTreeGrid.FieldLayouts>
</igDP:XamTreeGrid>
Hello mariak,
It is rather interesting that the SelectedDataItem property is working for you when your TemplateField's name is Name, but not FullName. I can't say at the moment why this would create a rift in behavior of the SelectedDataItem property, though. I believe your data item structure may help here, though. Would it be possible for you to please provide the code that you are using for your ViewModel and the data items that you are binding to the XamTreeGrid?
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer
thanks Andrew for your quick answer. Trying to put together a test view model for you made me see the issue, so it is working fine now.
If anyone has a similar problem: mine was an override of a non-read-only property that had no set; this was causing the weird behavior seen, not quite easy to spot.