protected override void OnApplyTemplate() { base.OnApplyTemplate(); _contentPresenter = GetTemplateChild("ContentPresenter") as WContentPresenter; _rootGrid = GetTemplateChild("RootGrid") as global::Windows.UI.Xaml.Controls.Grid; UpdateBackgroundColor(); UpdateBorderRadius(); }
public ShellItemRenderer(ShellRenderer shellContext) { System.Maui.Shell.VerifyShellUWPFlagEnabled(nameof(ShellItemRenderer)); _ = shellContext ?? throw new ArgumentNullException(nameof(shellContext)); ShellContext = shellContext; RowDefinitions.Add(new UwpRowDefinition() { Height = new UwpGridLength(1, UwpGridUnitType.Auto) }); RowDefinitions.Add(new UwpRowDefinition() { Height = new UwpGridLength(1, UwpGridUnitType.Star) }); RowDefinitions.Add(new UwpRowDefinition() { Height = new UwpGridLength(1, UwpGridUnitType.Auto) }); _Title = new TextBlock() { Style = Resources["SubtitleTextBlockStyle"] as UwpStyle, VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis, TextWrapping = TextWrapping.NoWrap }; _HeaderArea = new UwpGrid() { Height = 40, Padding = new UwpThickness(10, 0, 10, 0) }; _HeaderArea.ColumnDefinitions.Add(new UwpColumnDefinition() { Width = new UwpGridLength(1, UwpGridUnitType.Star) }); _HeaderArea.ColumnDefinitions.Add(new UwpColumnDefinition() { Width = new UwpGridLength(1, UwpGridUnitType.Auto) }); _HeaderArea.Children.Add(_Title); Children.Add(_HeaderArea); _Toolbar = new ItemsControl() { ItemTemplate = UwpApplication.Current.Resources["ShellToolbarItemTemplate"] as UwpDataTemplate, ItemsPanel = UwpApplication.Current.Resources["ShellToolbarItemsPanelTemplate"] as ItemsPanelTemplate, }; SetColumn(_Toolbar, 1); _HeaderArea.Children.Add(_Toolbar); SectionRenderer = shellContext.CreateShellSectionRenderer(); SetRow(SectionRenderer, 1); Children.Add(SectionRenderer); _BottomBar = new UwpGrid() { HorizontalAlignment = HorizontalAlignment.Center }; _BottomBarArea = new Border() { Child = _BottomBar }; SetRow(_BottomBarArea, 2); Children.Add(_BottomBarArea); }