This is a migrated thread and some comments may be shown as answers.
Moving RadTabItem
5 Answers 70 Views
This is a migrated thread and some comments may be shown as answers.
Hela
Top achievements
Rank 1
Hela asked on 21 Jan 2009, 08:13 AM
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

5 Answers, 1 is accepted

Sort by
0
Accepted
Boyan
Telerik team
answered on 22 Jan 2009, 04:47 PM
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.
0
Hela
Top achievements
Rank 1
answered on 29 Jan 2009, 03:44 PM
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
0
Deven
Top achievements
Rank 1
answered on 30 Jun 2009, 07:25 AM
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();
    }

 

 

}

 

 

 

0
Kiril Stanoev
Telerik team
answered on 02 Jul 2009, 12:08 PM
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.
0
Deven
Top achievements
Rank 1
answered on 02 Jul 2009, 12:24 PM
That was spot on. It was silly on my part to not think of ObsColl.

Thanks much for your time.
Asked by
Hela
Top achievements
Rank 1
Answers by
Boyan
Telerik team
Hela
Top achievements
Rank 1
Deven
Top achievements
Rank 1
Kiril Stanoev
Telerik team
Share this question
or