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

Changing ItemSource and Paht dynamically

5 Answers 98 Views
BreadCrumb
This is a migrated thread and some comments may be shown as answers.
Swarna
Top achievements
Rank 1
Swarna asked on 16 Sep 2011, 11:51 PM
Hi,
I am trying to change the itemssource and then path for breadcrumb. If I change the Path right after changing temssource, it does not work. If I change the Path on an event then it works.
items source model:

 

 

public class BCSource

 

{

 

 

public string name { get; set; }

 

 

 

public ObservableCollection<BCSource> values { get; set; }

 

}

and source:

 

 

 

 

si1.name = "1";
          si1.values = new ObservableCollection<BCSource>() { 
                      new BCSource()
                      {
                              name = "1.1",
                              values=new ObservableCollection<BCSource>()
                                      { new BCSource()
                                          {
                                          name = "1.1.1",
                                          values=new ObservableCollection<BCSource>()
                                          }, 
                                         new BCSource()
                                         {
                                          name = "1.1.2",
                                          values=new ObservableCollection<BCSource>()
                                          }
                                      }
                      },
                      new BCSource()
                          {
                                  name = "1.2",
                                  values=new ObservableCollection<BCSource>()
                                          { new BCSource()
                                              {
                                              name = "1.2.1",
                                              values=new ObservableCollection<BCSource>()
                                              }, 
                                              new BCSource()
                                              {
                                              name = "1.2.2",
                                              values=new ObservableCollection<BCSource>()
                                              }
                                          }
                          },
                      new BCSource()
                          {
                                  name = "1.2",
                                  values=new ObservableCollection<BCSource>()
                                          { new BCSource()
                                              {
                                              name = "1.2.1",
                                              values=new ObservableCollection<BCSource>()
                                              }, 
                                              new BCSource()
                                              {
                                              name = "1.2.2",
                                              values=new ObservableCollection<BCSource>()
                                              {
                                                  new BCSource()
                                                      {
                                                      name = "1.2.2.1",
                                                      values=new ObservableCollection<BCSource>()
                                                      }, 
                                                  new BCSource()
                                                      {
                                                      name = "1.2.2.2",
                                                      values=new ObservableCollection<BCSource>()
                                                      }
                                              }
                                              }
                                          }
                          }};

 Bread crumb def:
<telerik:RadBreadcrumb 
  
  
x:Name="ToolsBreadCrumb"
  
VerticalAlignment="Top"
  
HeaderMemberPath="name"
  
HierarchicalItemsSource="values"
  
IsTextModeEnabled="False"
  
HierarchicalMemberPath="name"
  
TextModePath="name" IsLinearMode="False"
  
IsTextSearchEnabled="False"
  
PathSeparator=">"
  
Margin="4,4,2,0"
  
/>

toolsbreadcrumb in button_click, but this has no effect.

 

 

private void Button_Click(object sender, RoutedEventArgs e)

 

{

ToolsBreadCrumb.Header = si1;

ToolsBreadCrumb.ItemsSource = si1.values;

ToolsBreadCrumb.Path =

 

"1>1.1";

 

}

I want to change the itemsource and then set the path in single event.
Any suggestion on this.

thanks

5 Answers, 1 is accepted

Sort by
0
Zarko
Telerik team
answered on 19 Sep 2011, 04:51 PM
Hello Swarna,
We are aware of this issue and you can track its progress here. The fix should be available in the next internal build.
If you have more questions feel free to ask.

All the best,
Zarko
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Swarna
Top achievements
Rank 1
answered on 20 Sep 2011, 03:03 AM
Hi Zarko,
Do you have any work around for this problem?


Thanks,
Swarna
0
Zarko
Telerik team
answered on 20 Sep 2011, 05:21 PM
Hello Swarna,
A possible workaround will be to set the ItemsSource after that wait a little bit and then set the Path property. This can usualy be done with a Dispatcher, so could you please try this code:
private void Button_Click(object sender, RoutedEventArgs e)
{
    ToolsBreadCrumb.Header = si1;
    ToolsBreadCrumb.ItemsSource = si1.values;
    this.Dispatcher.BeginInvoke(new Action(() =>
    {
        ToolsBreadCrumb.Path = "1>1.1";
    }));
}
If you have more questions please feel free to ask.

Best wishes,
Zarko
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Glen
Top achievements
Rank 1
answered on 26 Sep 2011, 11:09 AM
We were using the method mentioned to set the path after initial load and still do.

With the latest release though the Path just won't accept being set. This is fairly flaky as sometimes it works and sometimes it doesn't.

On initial load it generally works, it's more evident when we set the path post load (We have a treeview bound to the same VM as the breadcrumb).
0
Zarko
Telerik team
answered on 28 Sep 2011, 10:00 AM
Hello Glen,
Could you please send us some code snippets or a sample project that reproduces the issue, because when we tested the Path property for the SP release everything seemed to work fine?

Best wishes,
Zarko
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
BreadCrumb
Asked by
Swarna
Top achievements
Rank 1
Answers by
Zarko
Telerik team
Swarna
Top achievements
Rank 1
Glen
Top achievements
Rank 1
Share this question
or