Moving RadTabItem

6 posts, 1 answers
  1. Hela
    Hela avatar
    4 posts
    Member since:
    Jan 2009

    Posted 21 Jan 2009 Link to this post

    Hello,

    I am relatively new to SilverLight Applications and I'd like to create a tab control in which the  RadTabItem can be moved.
    So when the TabItem is clicked then dragged, it can be placed in the TabControl  once the mouse is released. 
           
    Thanks
    Héla
  2. Answer
    Boyan
    Admin
    Boyan avatar
    758 posts

    Posted 22 Jan 2009 Link to this post

    Hello Hela,

    As far as i understand your question you want to do something similar to one of our online demos. Please check this demo at http://demos.telerik.com/silverlight/#TabControl/DragReorder and tell us if this works for you.

    All the best,
    Boyan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft banner
  4. Hela
    Hela avatar
    4 posts
    Member since:
    Jan 2009

    Posted 29 Jan 2009 Link to this post

    Hello Boyan ,
    Thx for your answer.It's what I needed to know.
    My reply is a little bit late coz i've already found the answer in an other example.
    Thx again and good luck for you!
    Héla
  5. Deven
    Deven avatar
    33 posts
    Member since:
    Apr 2009

    Posted 30 Jun 2009 Link to this post

    On a little different note. The dragReorder works if the tab items are created in the xaml. I created tab items on the run (binding) and I am not able to reorder by dragging them. Am I missing anything?  Below is the snapshot of my code.

     

     

    <tnav:RadTabControl x:Name="MyTab" AllowDragReorder="True" ItemsSource="{Binding list, Converter={StaticResource tc}}"/>

    public class TabConverter : IValueConverter
    {

     

     

     

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

     

     

        {

     

            List<PortfolioTab> source = value as List<PortfolioTab>;

     

           DataTemplate dt = App.Current.Resources["tabHeader"] as DataTemplate;
            if (source != null)
            {

     

     

     

                List<RadTabItem> result = new List<RadTabItem>();
                host = someUserControl;
                foreach (PortfolioTab tab in source)
                {

     

     

     

                    result.Add(

     

     

                    new RadTabItem()

                     {

                        Tag = tab.TabID,

                        Header = tab.TabTitle,

                        Content = host

                    });

                 }

     

                return result;
            }

     

     

     

     

            return null;
        }

     

     

     

     

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

        {

     

            throw new NotImplementedException();
        }

     

     

    }

     

     

     

  6. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 02 Jul 2009 Link to this post

    Hi Deven,

    You have to return an ObservableCollection<RadTabItem> instead of a List<RadTabItem>. While reordering the tabs the ItemsSource changes and the ObservableCollection will notice the changes.

    I have attached a sample project that demonstrates the usage of ObservableCollection. Have a look at it and try the approach in your application.
    Let me know if you experience any additional problems.

    All the best,
    Kiril Stanoev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. Deven
    Deven avatar
    33 posts
    Member since:
    Apr 2009

    Posted 02 Jul 2009 Link to this post

    That was spot on. It was silly on my part to not think of ObsColl.

    Thanks much for your time.
Back to Top
DevCraft banner