This is a migrated thread and some comments may be shown as answers.

Binding with an observable collection

1 Answer 172 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
sonal
Top achievements
Rank 1
sonal asked on 16 Dec 2008, 02:31 PM
I am binding RadTreeView with an observable collection and following is the HeirarchicalDataTemplate:

<HierarchicalDataTemplate DataType="{x:Type amms:Node}" ItemsSource="{Binding Children}" >
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Path=NodeText, Mode=TwoWay}"
                                   Visibility="{Binding Path=IsEditCompleted, Converter={StaticResource boolToVisibleConverter}, Mode=TwoWay,
                                   NotifyOnTargetUpdated=True}"  TargetUpdated="uxTextBlock_TargetUpdated">
                        </TextBlock>
                    </StackPanel>
</HierarchicalDataTemplate>

When I initially set the RadTreeView's  datacontext, binding defined in HierarchicalDataTemplate works well for all the rendered items
textblock visibility changes as IsEditCompleted changes and uxTextBlock_TargetUpdated also hits.

But when i add an item to observable collection "Children",  it is being rendered in the RadTreeView at proper position but IsEditCompleted changes and uxTextBlock_TargetUpdated does not get hit. It looks like binding is not set up properly for newly added item via observable collection.

Please check the issue and let me know if it is a known issue and if there is any workaround.

Thanks
Sonal




1 Answer, 1 is accepted

Sort by
0
Miroslav
Telerik team
answered on 18 Dec 2008, 12:29 PM
Hi Sonal,

The RadTreeView items go though the same process when initialized, since the binding logic is in the ItemsControl.

Unfortunately I could not reproduce the issue. I am attaching the project I used. I am not sure why the binding will work differently when the items are added at different times.

More details on the issue or a simple project will make identifying the problem much easier.

All the best,
Miroslav
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
TreeView
Asked by
sonal
Top achievements
Rank 1
Answers by
Miroslav
Telerik team
Share this question
or