Guest User

ava

a guest
Feb 5th, 2025
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.29 KB | None | 0 0
  1. public void CreateTabLayout()
  2. {
  3.     var grid = new Grid
  4.     {
  5.         RowDefinitions =
  6.         {
  7.             new RowDefinition(GridLength.Auto),
  8.             new RowDefinition(GridLength.Star)
  9.         }
  10.     };
  11.     var dock = new Panel
  12.     {
  13.         VerticalAlignment = VerticalAlignment.Center,  
  14.         Children =
  15.         {
  16.             new TextBlock
  17.             {
  18.                 Text = "Aspira",
  19.                 FontSize = 18,
  20.                 //Foreground = _materialSecondary,
  21.                 HorizontalAlignment = HorizontalAlignment.Center,
  22.                 VerticalAlignment = VerticalAlignment.Stretch
  23.             }
  24.         }
  25.     };
  26.  
  27.     var tab = new TabControl
  28.     {
  29.         FontFamily = "Montserrat",
  30.         TabStripPlacement = Dock.Top,
  31.         Items =
  32.         {
  33.             HomeTab(),
  34.             CreateFavouritesTab(),
  35.             CreateHistoryTab(),
  36.             CreateSettingsTab(),
  37.  
  38.         }
  39.     };
  40.  
  41.     Grid.SetRow(dock, 0);
  42.     Grid.SetRow(tab, 1);
  43.     grid.Children.Add(dock);
  44.     grid.Children.Add(tab);
  45.  
  46.     this.Content = grid;
  47. }
  48.  
  49. private Control HomeTab()
  50. {
  51.     var homeIcon = new MaterialIcon
  52.     {
  53.         HorizontalAlignment = HorizontalAlignment.Stretch,
  54.         VerticalAlignment = VerticalAlignment.Stretch,
  55.         Kind = MaterialIconKind.Home,
  56.         RenderTransform = _scaleTransform1_5,
  57.     };
  58.  
  59.     var ofthedayTabItem = new TabItem
  60.     {
  61.         HorizontalAlignment = HorizontalAlignment.Stretch,
  62.         VerticalAlignment = VerticalAlignment.Stretch,
  63.         Header = "Of the day",
  64.         Content = new OfTheDayPageContent(_mainViewModel, _modv2ViewModel)
  65.     };
  66.  
  67.     var onthisdayTabItem = new TabItem
  68.     {
  69.         //HorizontalAlignment = HorizontalAlignment.Stretch,
  70.         VerticalAlignment = VerticalAlignment.Stretch,
  71.         Header = "On this day",
  72.         Content = new OnThisDayPageContent(_mainViewModel)
  73.     };
  74.  
  75.     var subTab = new TabControl
  76.     {
  77.        
  78.         TabStripPlacement = Dock.Top,
  79.         Items =
  80.         {
  81.             ofthedayTabItem,
  82.             onthisdayTabItem
  83.         }
  84.     };
  85.  
  86.     return new TabItem
  87.     {
  88.         //HorizontalAlignment = HorizontalAlignment.Stretch,
  89.         VerticalAlignment = VerticalAlignment.Stretch,
  90.         Header = homeIcon,
  91.         Content = subTab
  92.     };
  93. }
Advertisement
Add Comment
Please, Sign In to add comment