Example #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,
             }
         }
     };
 }
Example #2
0
 /// <summary>
 /// The default template for the <see cref="TabControl"/> control.
 /// </summary>
 /// <param name="control">The control being styled.</param>
 /// <returns>The root of the instantiated template.</returns>
 public static 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",
                 [!ItemsControl.ItemsProperty] = control[!ItemsControl.ItemsProperty],
                 [!!SelectingItemsControl.SelectedItemProperty] = control[!!SelectingItemsControl.SelectedItemProperty],
             },
             new Deck
             {
                 Name = "deck",
                 MemberSelector = new FuncMemberSelector<TabItem, object>(x => x.Content),
                 [!Deck.ItemsProperty] = control[!ItemsControl.ItemsProperty],
                 [!Deck.SelectedItemProperty] = control[!SelectingItemsControl.SelectedItemProperty],
                 [~Deck.TransitionProperty] = control[~TabControl.TransitionProperty],
                 [Grid.RowProperty] = 1,
             }
         }
     };
 }
Example #3
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,
             }
         }
     };
 }
Example #4
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
                     {
                         Name = "PART_TabStrip",
                         ItemsPanel = new FuncTemplate<IPanel>(() => new StackPanel { Orientation = Orientation.Vertical, Gap = 4 }),
                         Margin = new Thickness(0, 10, 0, 0),
                         MemberSelector = TabControl.HeaderSelector,
                         [!ItemsControl.ItemsProperty] = control[!ItemsControl.ItemsProperty],
                         [!!SelectingItemsControl.SelectedItemProperty] = control[!!SelectingItemsControl.SelectedItemProperty],
                     }
                 }
             },
             new Carousel
             {
                 Name = "PART_Content",
                 MemberSelector = TabControl.ContentSelector,
                 [~Carousel.TransitionProperty] = control[~TabControl.TransitionProperty],
                 [!Carousel.ItemsProperty] = control[!ItemsControl.ItemsProperty],
                 [!Carousel.SelectedItemProperty] = control[!SelectingItemsControl.SelectedItemProperty],
                 [Grid.ColumnProperty] = 1,
             }
         }
     };
 }
Example #5
0
        public static Window Create()
        {

            TabControl container;


            Window window = new Window
            {
                Title = "Perspex Test Application",
                //Width = 900,
                //Height = 480,
                Content = (container = new TabControl
                {
                    Padding = new Thickness(5),
                    Items = new[]
                    {
                        ButtonsTab(),
                        TextTab(),
                        HtmlTab(),
                        ImagesTab(),
                        ListsTab(),
                        LayoutTab(),
                        AnimationsTab(),
                    },
                    Transition = new CrossFade(TimeSpan.FromSeconds(0.25)),
                    [Grid.RowProperty] = 1,
                    [Grid.ColumnSpanProperty] = 2,
                })

            };

            container.Classes.Add("container");
            
            window.Show();
            return window;
        }
Example #6
0
        private static void Main(string[] args)
        {
            // The version of ReactiveUI currently included is for WPF and so expects a WPF
            // dispatcher. This makes sure it's initialized.
            System.Windows.Threading.Dispatcher foo = System.Windows.Threading.Dispatcher.CurrentDispatcher;

            new App
            {
                DataTemplates = new DataTemplates
                {
                    new FuncTreeDataTemplate<Node>(
                        x => new TextBlock { Text = x.Name },
                        x => x.Children,
                        x => true),
                },
            };

            TabControl container;

            Window window = new Window
            {
                Title = "Perspex Test Application",
                Width = 900,
                Height = 480,
                Content = new Grid
                {
                    ColumnDefinitions = new ColumnDefinitions
                    {
                        new ColumnDefinition(1, GridUnitType.Star),
                        new ColumnDefinition(1, GridUnitType.Star),
                    },
                    RowDefinitions = new RowDefinitions
                    {
                        new RowDefinition(GridLength.Auto),
                        new RowDefinition(1, GridUnitType.Star),
                        new RowDefinition(GridLength.Auto),
                    },
                    Children = new Controls
                    {
                        (container = new TabControl
                        {
                            Padding = new Thickness(5),
                            Items = new[]
                            {
                                ButtonsTab(),
                                TextTab(),
                                HtmlTab(),
								ImagesTab(),
                                ListsTab(),
                                LayoutTab(),
                                AnimationsTab(),
                            },
                            Transition = new CrossFade(TimeSpan.FromSeconds(0.25)),
                            [Grid.RowProperty] = 1,
                            [Grid.ColumnSpanProperty] = 2,
                        })
                    }
                },
            };

            container.Classes.Add(":container");

            DevTools.Attach(window);
            window.Show();
            Application.Current.Run(window);
        }