예제 #1
0
 private Control Template(TabControl control)
 {
     return new Grid
     {
         RowDefinitions = new RowDefinitions
         {
             new RowDefinition(GridLength.Auto),
             new RowDefinition(new GridLength(1, GridUnitType.Star)),
         },
         Children = new Controls
         {
             new TabStrip
             {
                 Name = "tabStrip",
                 [~TabStrip.ItemsProperty] = control[~TabControl.ItemsProperty],
                 [!!TabStrip.SelectedItemProperty] = control[!!TabControl.SelectedItemProperty],
             },
             new Deck
             {
                 Name = "deck",
                 DataTemplates = new DataTemplates
                 {
                     new DataTemplate<TabItem>(x => (Control)control.MaterializeDataTemplate(x.Content)),
                 },
                 [~Deck.ItemsProperty] = control[~TabControl.ItemsProperty],
                 [!Deck.SelectedItemProperty] = control[!TabControl.SelectedItemProperty],
                 [~Deck.TransitionProperty] = control[~TabControl.TransitionProperty],
                 [Grid.RowProperty] = 1,
             }
         }
     };
 }
예제 #2
0
 public static Control TabControlTemplate(TabControl control)
 {
     return new Grid
     {
         ColumnDefinitions = new ColumnDefinitions
         {
             new ColumnDefinition(GridLength.Auto),
             new ColumnDefinition(new GridLength(1, GridUnitType.Star)),
         },
         Children = new Controls
         {
             new Border
             {
                 Width = 190,
                 Background = SolidColorBrush.Parse("#1976D2"),
                 Child = new ScrollViewer
                 {
                     Content = new TabStrip
                     {
                         ItemsPanel = new FuncTemplate<IPanel>(() => new StackPanel { Orientation = Orientation.Vertical, Gap = 4 }),
                         Margin = new Thickness(0, 10, 0, 0),
                         Name = "internalStrip",
                         [!ItemsControl.ItemsProperty] = control[!ItemsControl.ItemsProperty],
                         [!!SelectingItemsControl.SelectedItemProperty] = control[!!SelectingItemsControl.SelectedItemProperty],
                     }
                 }
             },
             new Deck
             {
                 Name = "deck",
                 DataTemplates = new DataTemplates
                 {
                     new DataTemplate<TabItem>(x => (Control)control.MaterializeDataTemplate(x.Content)),
                 },
                 [~Deck.TransitionProperty] = control[~TabControl.TransitionProperty],
                 [!ItemsControl.ItemsProperty] = control[!ItemsControl.ItemsProperty],
                 [!SelectingItemsControl.SelectedItemProperty] = control[!SelectingItemsControl.SelectedItemProperty],
                 [Grid.ColumnProperty] = 1,
             }
         }
     };
 }