Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
260
Tab Items in dropdown list instead of scroll
posted

Hi, 

       I am using xamtab control i want to add tab items in a dropdown list instead of scroll when number of tabs exced from its limit like pages/windows  in dropdown list in visual studio.

Parents
No Data
Reply
  • 54937
    Offline posted

    xamDockManager provides that functionality for the document tab groups within its DocumentContentHost (analogous to VS' tabbed documents) but this isn't something directly provided by the xamTabControl. You could probably put a Menu in the PostTabItemContent area that creates a menu item for each item in the tab control. e.g.

            <igWindows:XamTabControl x:Name="tabControl">
                <igWindows:XamTabControl.PostTabItemContent>
                    <Menu>
                        <MenuItem Header="V" 
                                  Click="MenuItem_Click"
                                  ItemsSource="{Binding Path=Items, RelativeSource={RelativeSource AncestorType={x:Type igWindows:XamTabControl}}}">
                            <MenuItem.ItemContainerStyle>
                                <Style TargetType="{x:Type MenuItem}">
                                    <!-- You could use a setter to set the command that you would use to select the tab -->
                                    <Setter Property="CommandTarget" Value="{Binding}" />
                                    <Setter Property="Header" Value="{Binding Path=Header}" />
                                </Style>
                            </MenuItem.ItemContainerStyle>
                        </MenuItem>
                    </Menu>
                </igWindows:XamTabControl.PostTabItemContent>
                <igWindows:TabItemEx Header="One">
                    <Button Content="Button 1" />
                </igWindows:TabItemEx>
                <igWindows:TabItemEx Header="Two">
                    <Button Content="Button 2" />
                </igWindows:TabItemEx>
            </igWindows:XamTabControl>
         
            private void MenuItem_Click(object sender, RoutedEventArgs e)
            {
                MenuItem clickedItem = e.OriginalSource as MenuItem;
     
                if (null != clickedItem && null != clickedItem.CommandTarget)
                {
                    // if you're binding the itemssource or not using tab items then
                    // you'll probably need to go through the tab control's 
                    // ItemContainerGenerator to get the index and set that as the selected
                    // index on the tab control.
                    TabItem ti = clickedItem.CommandTarget as TabItem;
     
                    if (null != ti)
                        ti.IsSelected = true;
                }
            }
     

     

Children