private void animate_inactive() { Border border = this.Template.FindName("ButtonCard_BorderControl", this) as Border; border.AnimateBackground( (Color)Application.Current.Resources["RawIndigo"], (Color)Application.Current.Resources["RawLightestGray"], TimeSpan.FromSeconds(0.15)); }
public void DrawMenu() { try { foreach (FKMenuHelper.MenuStruct Item in Items) { Border Border = new Border { Width = 35, Height = 32, Background = Extensions.HexToBrush(Item.MouseEvent.Color.Reset.Color.ToString(), false), BorderBrush = Extensions.HexToBrush("#e9e9e9", false), BorderThickness = new Thickness(0, 1, 0, 1), CornerRadius = new CornerRadius(0), Tag = new FKMethods.TagHelper { Transition = Item.MouseEvent.Color }, ToolTip = new Label { Content = Item.Title } }; bool Match = false; foreach (Border x in IconMenu.Children.OfType <Border>()) { if (x.Name == "DropDown") { Match = true; } } if (Match) { if (Item.Equals(Items.First())) { Border.Background = Extensions.HexToBrush(Item.MouseEvent.Color.Active.Color.ToString(), false); Border.BorderThickness = new Thickness(0, 1, 0, 1); Border.CornerRadius = new CornerRadius(0, 0, 0, 0); } else if (Item.Equals(Items.Last())) { Border.BorderThickness = new Thickness(0, 1, 1, 1); Border.CornerRadius = new CornerRadius(0, 4, 4, 0); } } else { if (Item.Equals(Items.First())) { Border.Background = Extensions.HexToBrush(Item.MouseEvent.Color.Active.Color.ToString(), false); Border.BorderThickness = new Thickness(1, 1, 0, 1); Border.CornerRadius = new CornerRadius(4, 0, 0, 4); } else if ((Items[0].Items != null && Item.Equals(Items[1]))) { Border.Background = Extensions.HexToBrush(Item.MouseEvent.Color.Active.Color.ToString(), false); } else if (Item.Equals(Items.Last())) { Border.BorderThickness = new Thickness(0, 1, 1, 1); Border.CornerRadius = new CornerRadius(0, 4, 4, 0); } } Border.Child = new Image() { Source = Item.Image.Source, Width = Item.Image.Width, Height = Item.Image.Height }; Image BorderImage = Border.Child as Image; Border.MouseEnter += ((s, e) => { BorderImage.Source = Item.MouseEvent.Enter; Border.AnimateBackground(Border.Tag); }); Border.MouseLeave += ((s, e) => { BorderImage.Source = Item.MouseEvent.Leave; Border.AnimateBackground(Border.Tag, true); }); Border.MouseDown += ((s, e) => { LoadPage(Item.Invoke, Border, Item); }); IconMenu.Children.Add(Border); } } catch (Exception e) { MessageBox.Show(e.ToString()); } }
public void DrawSubMenuContainer() { foreach (FKMenuHelper.MenuStruct Item in SubMenu) { Border Border = new Border { Width = 35, Height = 32, Background = Extensions.HexToBrush(Item.MouseEvent.Color.Reset.Color.ToString(), false), BorderBrush = Extensions.HexToBrush("#e9e9e9", false), BorderThickness = new Thickness(0, 1, 0, 1), CornerRadius = new CornerRadius(0), Tag = new FKMethods.TagHelper { Transition = Item.MouseEvent.Color }, ToolTip = new Label { Content = Item.Title } }; if (Item.Equals(SubMenu.First())) { Border.Background = Extensions.HexToBrush(Item.MouseEvent.Color.Active.Color.ToString(), false); Border.BorderThickness = new Thickness(1, 1, 0, 1); Border.CornerRadius = new CornerRadius(4, 0, 0, 4); } else if ((SubMenu[0].Items != null && Item.Equals(SubMenu[1]))) { Border.Background = Extensions.HexToBrush(Item.MouseEvent.Color.Active.Color.ToString(), false); } else if (Item.Equals(SubMenu.Last())) { Border.BorderThickness = new Thickness(0, 1, 1, 1); Border.CornerRadius = new CornerRadius(0, 4, 4, 0); } Border.Child = Item.Image; Image BorderImage = Border.Child as Image; Border.MouseEnter += ((s, e) => { BorderImage.Source = Item.MouseEvent.Enter; Border.AnimateBackground(Border.Tag); }); Border.MouseLeave += ((s, e) => { BorderImage.Source = Item.MouseEvent.Leave; Border.AnimateBackground(Border.Tag, true); }); Border.MouseDown += ((s, e) => { if (Item.InvokeMethod == null) { return; } Item.InvokeMethod.Invoke(); }); SubMenuContainer.Children.Add(Border); } }