Changing ItemSource and Paht dynamically

6 posts, 0 answers
  1. Swarna
    Swarna avatar
    6 posts
    Member since:
    May 2009

    Posted 16 Sep 2011 Link to this post

    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

  2. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 19 Sep 2011 Link to this post

    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 >>

  3. DevCraft banner
  4. Swarna
    Swarna avatar
    6 posts
    Member since:
    May 2009

    Posted 19 Sep 2011 Link to this post

    Hi Zarko,
    Do you have any work around for this problem?


    Thanks,
    Swarna
  5. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 20 Sep 2011 Link to this post

    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 >>

  6. Glen
    Glen avatar
    17 posts
    Member since:
    Aug 2010

    Posted 26 Sep 2011 Link to this post

    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).
  7. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 28 Sep 2011 Link to this post

    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 >>

Back to Top
DevCraft banner