Binding with an observable collection

2 posts, 0 answers
  1. sonal
    sonal avatar
    15 posts
    Member since:
    Jul 2008

    Posted 16 Dec 2008 Link to this post

    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




  2. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 18 Dec 2008 Link to this post

    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.
Back to Top