Path Property

4 posts, 1 answers
  1. Bassam
    Bassam avatar
    8 posts
    Member since:
    Mar 2015

    Posted 23 Mar 2015 Link to this post

    I am setting the Path Property in my code. I have found that  It is not accepting the  value I set.

    I picking up the values directly from the TreeView Control. 

    How can I validate the value before I set it?

      private void onJobBreadcrumbCurrentItemChanged(object sender, Telerik.Windows.RadRoutedEventArgs e)<br>    {<br>      this._radTreeView.BringPathIntoView(this.jobBreadcrumb.Path);<br>      this._radTreeView.SelectedItem = this.jobBreadcrumb.CurrentItem;<br>    }<br><br>    private void onJobTreeSelectionChanged(object sender, SelectionChangedEventArgs e)<br>    {<br>      if (e.AddedItems.Count > 0 && this._radTreeView.ContainerFromItemRecursive(e.AddedItems[0]) != null)<br>      {<br>        var path =  this._radTreeView.ContainerFromItemRecursive(e.AddedItems[0]).FullPath;<br>        this.jobBreadcrumb.Path = path;<br>      }<br>    }

      <telerik:RadBreadcrumb x:Name="jobBreadcrumb"<br>                               HorizontalAlignment="Stretch" <br>                               VerticalAlignment="Top" <br>                                  Grid.Row="0"<br>                                   CurrentItemChanged="onJobBreadcrumbCurrentItemChanged"<br>                                 IsTextModeEnabled="False"<br>                               Header="{Binding CurrentBid.Text}"<br>                               ImagePath="ImageSource"<br>                               IsIconVisible="True"<br>                                ItemContainerStyleSelector="{StaticResource JobTreeItemStyleSelector}"<br>                               ItemsSource="{Binding CurrentBid.Scenarios}"><br>    </telerik:RadBreadcrumb><br><br><br><br>  <telerik:RadTreeView  <br>                          x:Name="jobTreeView" <br>                          ItemsSource="{Binding CurrentBid.Scenarios}" <br>                          ItemTemplateSelector="{StaticResource JobTreeItemTemplateSelector}" <br>                          IsDragDropEnabled="True" <br>                          telerik:TextSearch.TextPath="Text"<br>                          Grid.Row="1"><br>    </telerik:RadTreeView> <br>

  2. Bassam
    Bassam avatar
    8 posts
    Member since:
    Mar 2015

    Posted 23 Mar 2015 in reply to Bassam Link to this post

    Oops, the formatting came really off 

  3. Answer
    Martin Ivanov
    Martin Ivanov avatar
    2511 posts

    Posted 24 Mar 2015 Link to this post

    Hi Bassam,

    The Path property of the breadcrumb cannot be set because the FullPath that comes from the selected treeview item doesn't match a valid path from the breadcrumb. Currently, when the text mode is disabled the breadcrumb control is constructing its Path by using the ItemsSource's objects ToString() method. For example, if the control is populated with objects of type MyDataItem the path will be something like this - "MyApplicationNamespace.MyDataItem\\MyApplicationNamespace.MyDataItem". On the other hand the tree view will use its Text property to construct the FullPath of the treeview items. For example a tree item's path could look like this - "Item1\\Item1.1", which won't be a valid path in the breadcrumb.

    In order to achieve your requirement you can enable the TextMode of RadBreadcrumb and set the TextModePath property to the same property name as the value of the TextSearch.TextPath attached property set on the treeview. This way the paths in both controls will use the same pattern and values which will bring the desired effect of synchronization between the components.

    For your convenience I attached a sample project demonstrating this implementation. Please give it a try and let me know if it works for you.


    See What's Next in App Development. Register for TelerikNEXT.

  4. Bassam
    Bassam avatar
    8 posts
    Member since:
    Mar 2015

    Posted 24 Mar 2015 in reply to Martin Ivanov Link to this post

    Thanks It worked! 
Back to Top