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

Path Property

3 Answers 203 Views
BreadCrumb
This is a migrated thread and some comments may be shown as answers.
Bassam
Top achievements
Rank 1
Bassam asked on 23 Mar 2015, 09:03 PM
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>

Assuming, 

3 Answers, 1 is accepted

Sort by
0
Bassam
Top achievements
Rank 1
answered on 23 Mar 2015, 09:08 PM
Oops, the formatting came really off 

0
Accepted
Martin Ivanov
Telerik team
answered on 24 Mar 2015, 11:27 AM
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.

Regards,
Martin
Telerik
 

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

 
0
Bassam
Top achievements
Rank 1
answered on 24 Mar 2015, 01:08 PM
Thanks It worked! 
Tags
BreadCrumb
Asked by
Bassam
Top achievements
Rank 1
Answers by
Bassam
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or