private static void OnLoaded(object sender, RoutedEventArgs e) { var _this = (sender as SideAppBar); if (_this.CheckIfHandlerShouldExecute == false) { return; } _this.m_StackPanel1 = new StackPanel() { Margin = new Thickness(0, 0, 0, 0), Orientation = Orientation.Vertical, Width = _this.ActualWidth, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Stretch, Background = Brushes.Transparent, }; _this.m_ColorZone1 = new ColorZone() { Mode = ColorZoneMode.PrimaryDark, Width = _this.ActualWidth, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Stretch, SnapsToDevicePixels = true, }; ShadowAssist.SetShadowEdges(_this.m_ColorZone1, ShadowEdges.Right); ShadowAssist.SetShadowDepth(_this.m_ColorZone1, ShadowDepth.Depth0); SetZIndex(_this.m_ColorZone1, 0); SetZIndex(_this.m_StackPanel1, 0); foreach (var c in _this.Children.Cast <UIElement>().ToList().AsReadOnly()) { _this.Children.Remove(c); _this.m_StackPanel1.Children.Add(c); } _this.Children.Add(_this.m_ColorZone1); _this.Children.Add(_this.m_StackPanel1); _this.StartAnimExpand(); _this.CheckIfHandlerShouldExecute = false; }
private static void OnLoad(object sender, RoutedEventArgs e) { var This = (sender as TopAppBar_Apps); if (This.m_CheckIfHandlerShouldExecute == false) { return; } ///////////////////////////////////////////////////////////////////////////////// // PopupBox Button var PopupBox1 = new PopupBox() { Name = "TopAppBar_Notifications_PopupBox1", //Style = _this.FindResource("MaterialDesignToolPopupBox") as Style, //Width = 32, Height = 32, ClipToBounds = true, StaysOpen = true, Margin = new Thickness(0), Padding = new Thickness(0), HorizontalAlignment = HorizontalAlignment.Stretch, HorizontalContentAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Center, Foreground = This.FindResource("MaterialDesignPaper") as Brush, PopupMode = PopupBoxPopupMode.Click, UnfurlOrientation = Orientation.Vertical, PlacementMode = PopupBoxPlacementMode.BottomAndAlignRightEdges, FlowDirection = FlowDirection.LeftToRight, SnapsToDevicePixels = true, }; //EventManager.RegisterClassHandler(typeof(PopupBox), PopupBox.OpenedEvent, new RoutedEventHandler(OnPopupOpened)); var PackIcon1 = new PackIcon() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Width = 18, Height = 18, Kind = PackIconKind.Apps, Foreground = This.FindResource("MaterialDesignPaper") as Brush, }; PopupBox1.ToggleContent = PackIcon1; ShadowAssist.SetShadowDepth(PopupBox1, ShadowDepth.Depth0); RippleAssist.SetRippleSizeMultiplier(PopupBox1, 0.5f); RippleAssist.SetClipToBounds(PopupBox1, false); RippleAssist.SetIsCentered(PopupBox1, true); RippleAssist.SetIsDisabled(PopupBox1, true); // PopupBox Button End // Card var PrimaryStackPanel1 = new StackPanel() { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Orientation = Orientation.Vertical, }; var HeaderStackPanel1 = new StackPanel() { HorizontalAlignment = HorizontalAlignment.Stretch, Orientation = Orientation.Vertical, Background = Brushes.WhiteSmoke, }; var TextBlock1 = new TextBlock() { FontFamily = new FontFamily("Roboto"), Padding = new Thickness(96, 9, 96, 9), TextAlignment = TextAlignment.Center, FontSize = 13, Opacity = 0.75f, Text = Application.Current.MainWindow.Title == "" ? "Apps" : Application.Current.MainWindow.Title, //Background = Brushes.Purple, }; HeaderStackPanel1.Children.Add(TextBlock1); var Button1 = new Button() { Style = This.FindResource("MaterialDesignToolButton") as Style, Height = 16, Content = new PackIcon() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Width = 11, Height = 11, Kind = PackIconKind.ArrowCollapseDown, Margin = new Thickness(0, 0, 0, 0), Padding = new Thickness(0, 0, 0, 0), }, Padding = new Thickness(0, 0, 0, 0), Margin = new Thickness(0, 0, 0, 0), Background = Brushes.Gainsboro, }; ShadowAssist.SetShadowEdges(Button1.Content as PackIcon, ShadowEdges.Top); ShadowAssist.SetShadowDepth(Button1, ShadowDepth.Depth1); ShadowAssist.SetShadowEdges(Button1, ShadowEdges.Top); ShadowAssist.SetShadowDepth(Button1, ShadowDepth.Depth1); RippleAssist.SetIsDisabled(Button1, false); RippleAssist.SetIsCentered(Button1, true); RippleAssist.SetClipToBounds(Button1, true); RippleAssist.SetRippleSizeMultiplier(Button1, 12.0f); var ListView1 = new StackPanel() { MinWidth = 96, MinHeight = 192, Orientation = Orientation.Horizontal, FlowDirection = FlowDirection.LeftToRight, //HorizontalContentAlignment = HorizontalAlignment.Left, //VerticalContentAlignment = VerticalAlignment.Top, Background = Brushes.WhiteSmoke, }; //ListView1.Children.Add(new TextBlock() //{ // FontSize = 11, // Opacity = 0.75f, // Text = "Nothing to see here!", // //Width = 80, Height = 40, // TextAlignment = TextAlignment.Center, // HorizontalAlignment = HorizontalAlignment.Stretch, // VerticalAlignment = VerticalAlignment.Stretch, // Margin = new Thickness(0, 96, 0, 96), //}); var Button_App1 = new Button() { Name = "TopAppBar_Apps_App1_Button", Style = This.FindResource("MaterialDesignFlatButton") as Style, Margin = new Thickness(4), Padding = new Thickness(0), Width = 48, Height = 48, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top, Content = new PackIcon() { Width = 32, Height = 32, Padding = new Thickness(0), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0), //Foreground = This.FindResource("MaterialDesignPaper") as Brush, Kind = PackIconKind.Launch, }, ToolTip = "Launch Portal" }; RippleAssist.SetClipToBounds(Button_App1, true); RippleAssist.SetIsCentered(Button_App1, true); ShadowAssist.SetShadowDepth(Button_App1, ShadowDepth.Depth1); ListView1.Children.Add(Button_App1); var Button_App0 = new Button() { Name = "TopAppBar_Apps_App0_Button", Style = This.FindResource("MaterialDesignFlatButton") as Style, Margin = new Thickness(4), Padding = new Thickness(0), Width = 48, Height = 48, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top, Content = new PackIcon() { Width = 32, Height = 32, Padding = new Thickness(0), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(0), //Foreground = This.FindResource("MaterialDesignPaper") as Brush, Kind = PackIconKind.Home, }, ToolTip = "Home" }; RippleAssist.SetClipToBounds(Button_App0, true); RippleAssist.SetIsCentered(Button_App0, true); ShadowAssist.SetShadowDepth(Button_App0, ShadowDepth.Depth1); ListView1.Children.Add(Button_App0); EventManager.RegisterClassHandler(typeof(Button), MouseUpEvent, new RoutedEventHandler(OnAppChangedMouseUp)); PrimaryStackPanel1.Children.Add(HeaderStackPanel1); PrimaryStackPanel1.Children.Add(ListView1); PrimaryStackPanel1.Children.Add(Button1); // Card End PopupBox1.PopupContent = PrimaryStackPanel1; // Move PopupBox Attempt var part = PopupBox1.PopupContent as FrameworkElement; if (part == null) { Console.WriteLine("part = Null"); } else { var parent = part.Parent as FrameworkElement; if (parent == null) { Console.WriteLine("parent = Null"); } else if (parent != null) { parent.RenderTransform = new TranslateTransform(100, 0); } part.ClipToBounds = true; } // End This.Children.Add(PopupBox1); ///////////////////////////////////////////////////////////////////////////////// This.m_CheckIfHandlerShouldExecute = false; }
private static void OnLoad(object sender, RoutedEventArgs e) { var This = (sender as TopAppBar_Message); if (This.m_CheckIfHandlerShouldExecute == false) { return; } ///////////////////////////////////////////////////////////////////////////////// // PopupBox Button var PopupBox1 = new PopupBox() { Name = "TopAppBar_Notifications_PopupBox1", //Style = _this.FindResource("MaterialDesignToolPopupBox") as Style, //Width = 32, Height = 32, ClipToBounds = true, StaysOpen = true, Margin = new Thickness(0), Padding = new Thickness(0), HorizontalAlignment = HorizontalAlignment.Stretch, HorizontalContentAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Center, Foreground = This.FindResource("MaterialDesignPaper") as Brush, PopupMode = PopupBoxPopupMode.Click, UnfurlOrientation = Orientation.Horizontal, PlacementMode = PopupBoxPlacementMode.BottomAndAlignRightEdges, FlowDirection = FlowDirection.LeftToRight, UseLayoutRounding = true, }; EventManager.RegisterClassHandler(typeof(PopupBox), PopupBox.OpenedEvent, new RoutedEventHandler(OnMouseDown)); var PackIcon1 = new PackIcon() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Width = 18, Height = 18, Kind = PackIconKind.MessageProcessing, Foreground = This.FindResource("MaterialDesignPaper") as Brush, }; PopupBox1.ToggleContent = PackIcon1; ShadowAssist.SetShadowDepth(PopupBox1, ShadowDepth.Depth0); RippleAssist.SetRippleSizeMultiplier(PopupBox1, 0.5f); RippleAssist.SetClipToBounds(PopupBox1, false); RippleAssist.SetIsCentered(PopupBox1, true); RippleAssist.SetIsDisabled(PopupBox1, true); // PopupBox Button End // Card var PrimaryStackPanel1 = new StackPanel() { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Orientation = Orientation.Vertical, }; var HeaderStackPanel1 = new StackPanel() { HorizontalAlignment = HorizontalAlignment.Stretch, Orientation = Orientation.Vertical, Background = Brushes.WhiteSmoke, }; var TextBlock1 = new TextBlock() { FontFamily = new FontFamily("Roboto"), Padding = new Thickness(96, 9, 96, 9), TextAlignment = TextAlignment.Center, FontSize = 13, Opacity = 0.75f, Text = Application.Current.MainWindow.Title == "" ? "Messages" : Application.Current.MainWindow.Title, //Background = Brushes.Purple, }; HeaderStackPanel1.Children.Add(TextBlock1); var Button1 = new Button() { Style = This.FindResource("MaterialDesignToolButton") as Style, Height = 16, Content = new PackIcon() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Width = 11, Height = 11, Kind = PackIconKind.ArrowCollapseDown, Margin = new Thickness(0, 0, 0, 0), Padding = new Thickness(0, 0, 0, 0), }, Padding = new Thickness(0, 0, 0, 0), Margin = new Thickness(0, 0, 0, 0), Background = Brushes.Gainsboro, }; ShadowAssist.SetShadowEdges(Button1.Content as PackIcon, ShadowEdges.Top); ShadowAssist.SetShadowDepth(Button1, ShadowDepth.Depth1); ShadowAssist.SetShadowEdges(Button1, ShadowEdges.Top); ShadowAssist.SetShadowDepth(Button1, ShadowDepth.Depth1); RippleAssist.SetIsDisabled(Button1, false); RippleAssist.SetIsCentered(Button1, true); RippleAssist.SetClipToBounds(Button1, true); RippleAssist.SetRippleSizeMultiplier(Button1, 12.0f); var ListView1 = new StackPanel() { Orientation = Orientation.Vertical, Background = Brushes.WhiteSmoke, }; ListView1.Children.Add(new TextBlock() { FontSize = 11, Opacity = 0.75f, Text = "All caught up!", //Width = 80, Height = 40, TextAlignment = TextAlignment.Center, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Margin = new Thickness(0, 96, 0, 96), }); ShadowAssist.SetShadowEdges(ListView1, ShadowEdges.Bottom); ShadowAssist.SetShadowDepth(ListView1, ShadowDepth.Depth1); ShadowAssist.SetDarken(ListView1, true); PrimaryStackPanel1.Children.Add(HeaderStackPanel1); PrimaryStackPanel1.Children.Add(ListView1); PrimaryStackPanel1.Children.Add(Button1); // Card End PopupBox1.PopupContent = PrimaryStackPanel1; This.Children.Add(PopupBox1); ///////////////////////////////////////////////////////////////////////////////// This.m_CheckIfHandlerShouldExecute = false; }
private static void OnSizeChanged(object sender, RoutedEventArgs e) // this is called two times { // Only specify horizontal margin here. var _this = (sender as JumpComboBox); if (_this.CheckIfHandlerShouldExecute == false) { return; } var ColorZone1 = new ColorZone() { Mode = ColorZoneMode.Light, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, SnapsToDevicePixels = true, }; ShadowAssist.SetShadowEdges(ColorZone1, ShadowEdges.Right); ShadowAssist.SetShadowDepth(ColorZone1, ShadowDepth.Depth1); var StackPanel1 = new StackPanel() { Margin = new Thickness(0, 1, 0, 1), Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, //Background = Brushes.Transparent, }; var PackIcon1 = new PackIcon() { Margin = new Thickness(6, 0, 0, 0), Height = Convert.ToDouble(_this.ActualHeight), Width = Convert.ToDouble(14), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, HorizontalContentAlignment = HorizontalAlignment.Center, VerticalContentAlignment = VerticalAlignment.Center, Kind = PackIconKind.ViewList, //Background = Brushes.Transparent, }; StackPanel1.Children.Add(PackIcon1); var MyComboBox1 = new MyComboBox() { Margin = new Thickness(0, 0, 12, 0), Padding = new Thickness(4, 0, 0, 2), HorizontalContentAlignment = HorizontalAlignment.Left, VerticalContentAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, //Background = Brushes.Transparent, SnapsToDevicePixels = true, }; var srcList = _this.Children.Cast <UIElement>().ToList().AsReadOnly(); { for (int i = 0; i < srcList.Count; i++) { var eItem = srcList.ElementAt(i); if (!eItem.GetType().IsEquivalentTo(typeof(MyComboBoxItem))) { continue; } eItem.Visibility = Visibility.Collapsed; eItem.IsEnabled = false; var newItem = new MyComboBoxItem() { Margin = new Thickness(0, -(_this.Margin.Top / 2), 0, -(_this.Margin.Bottom / 2)), Content = $"{(eItem as MyComboBoxItem).Content}" }; MyComboBox1.Items.Add(newItem); } } StackPanel1.Children.Add(MyComboBox1); ColorZone1.Content = StackPanel1; _this.Children.Add(ColorZone1); _this.CheckIfHandlerShouldExecute = false; }
private static void OnLoaded(object sender, RoutedEventArgs e) { var _this = (sender as TopAppBar); if (_this.CheckIfHandlerShouldExecute == false) { return; } _this.m_StackPanel1 = new StackPanel() { Margin = new Thickness(0), Orientation = Orientation.Horizontal, Height = _this.ActualHeight, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, //Background = Brushes.Blue, }; _this.m_StackPanel2 = new StackPanel() { Margin = new Thickness(0, 0, 4, 0), Orientation = Orientation.Horizontal, FlowDirection = FlowDirection.RightToLeft, //Width = _this.ActualWidth * 0.25f, Height = _this.ActualHeight, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, //Background = Brushes.Red, }; _this.m_ColorZone1 = new ColorZone() { Mode = ColorZoneMode.PrimaryMid, Height = _this.ActualHeight, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, SnapsToDevicePixels = true, }; ShadowAssist.SetShadowEdges(_this.m_ColorZone1, ShadowEdges.Bottom); ShadowAssist.SetShadowDepth(_this.m_ColorZone1, ShadowDepth.Depth0); SetZIndex(_this.m_ColorZone1, 0); SetZIndex(_this.m_StackPanel1, 0); SetZIndex(_this.m_StackPanel2, 0); var TopAppBar_Navigation1 = new TopAppBar_Navigation(); var TopAppBar_UserAccount1 = new TopAppBar_UserAccount() { Width = 26, Height = 26, Margin = new Thickness(4, 4, 0, 4), ClipToBounds = true, }; var TopAppBar_Notifications1 = new TopAppBar_Notifications() { Width = 26, Height = 26, Margin = new Thickness(4, 4, 0, 4), ClipToBounds = true, }; var TopAppBar_Message1 = new TopAppBar_Message() { Width = 26, Height = 26, Margin = new Thickness(4, 4, 0, 4), ClipToBounds = true, }; var TopAppBar_Apps1 = new TopAppBar_Apps() { Width = 26, Height = 26, Margin = new Thickness(4, 4, 0, 4), ClipToBounds = true, }; _this.m_StackPanel2.Children.Add(TopAppBar_UserAccount1); _this.m_StackPanel2.Children.Add(TopAppBar_Notifications1); _this.m_StackPanel2.Children.Add(TopAppBar_Message1); _this.m_StackPanel2.Children.Add(TopAppBar_Apps1); _this.m_StackPanel1.Children.Add(TopAppBar_Navigation1); var TextBlock1 = new TextBlock() { Padding = new Thickness(0, 0, 0, 0), Text = _this.Header, FontSize = 14.5, FontWeight = FontWeights.Regular, Margin = new Thickness(0, 4, 8, 4), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Foreground = _this.FindResource("MaterialDesignPaper") as Brush, }; _this.m_StackPanel1.Children.Add(TextBlock1); foreach (var c in _this.Children.Cast <UIElement>().ToList().AsReadOnly()) { _this.Children.Remove(c); _this.m_StackPanel1.Children.Add(c); } _this.Children.Add(_this.m_ColorZone1); _this.Children.Add(_this.m_StackPanel1); _this.Children.Add(_this.m_StackPanel2); _this.CheckIfHandlerShouldExecute = false; }