WPF - close teleric tabItem.

2 posts, 1 answers
  1. Vitas Vitauskas
    Vitas Vitauskas avatar
    14 posts
    Member since:
    Dec 2009

    Posted 22 Dec 2009 Link to this post

    Hello, I organiza my windows like tabItems in tab controls. when i click on menu item:

            private void PaieskaTab_Click(object sender, Telerik.Windows.RadRoutedEventArgs e) 
                RadTabItem tabItem = new RadTabItem(); 
                ListTemplate lst = new ListTemplate(); 
                lst.tabWindow = tabItem
                tabItem.Content = lst
                tabItem.Header = "Paieskos langas"
                tabItem.Name = "tabPaieskosTestas"
    ListTemplate is a user control. In List template is a button "Close". Now when i click this button, i need that this tab,whitch contains this user control, would close. I try code from other forum in telerik:
                var tabItem = tabWindow as RadTabItem; 
                var parentItemsControl = Telerik.Windows.Controls.ItemsControl.ItemsControlFromItemContainer(tabItem); 
    But his code shows error:
    Error 23 The type or namespace name 'ItemsControl' does not exist in the namespace 'Telerik.Windows.Controls' (are you missing an assembly reference?) D:\!_Projects\Teleric_EmptyProject WPF\XSoftArt.WPFengine\XSoftArt.WPFengine\BaseClasses\ListTemplate.xaml.cs 1102 63 XSoftArt.WPFengine
    Its this becouse that code is for Silverlight..?How i must change it to get working..?
  2. Answer
    Valentin.Stoychev avatar
    2198 posts

    Posted 22 Dec 2009 Link to this post

    Hello Vitas Vitauskas,

    Yes - this is because you use a Silverlight code in WPF. You need to use System.Windows.Controls.ItemsControl instead.

    Check this help article:

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top