public NewUserControlMenuItem(itemMenu itemMenu, MainWindow context) { InitializeComponent(); _context = context; ExpanderMenu.Visibility = itemMenu.SubItems == null ? Visibility.Collapsed : Visibility.Visible; ListViewItemMenu.Visibility = itemMenu.SubItems == null ? Visibility.Visible : Visibility.Collapsed; this.DataContext = itemMenu; }
public MainWindow() { InitializeComponent(); var menuRegister = new List <SubItems>(); menuRegister.Add(new SubItems("Customesr", new UserControlCustomers())); menuRegister.Add(new SubItems("Providers", new UserControlProviders())); menuRegister.Add(new SubItems("Employees")); menuRegister.Add(new SubItems("Products")); var item6 = new itemMenu("Register", menuRegister, PackIconKind.Register); var menuSchedule = new List <SubItems>(); menuSchedule.Add(new SubItems("Service")); menuSchedule.Add(new SubItems("Meetings")); var item1 = new itemMenu("Appoinments", menuSchedule, PackIconKind.Schedule); var menuReports = new List <SubItems>(); menuReports.Add(new SubItems("Customer")); menuReports.Add(new SubItems("Provider")); menuReports.Add(new SubItems("Product")); menuReports.Add(new SubItems("Stock")); menuReports.Add(new SubItems("Sales")); var item2 = new itemMenu("Reports", menuReports, PackIconKind.FileReport); var menuExepenses = new List <SubItems>(); menuExepenses.Add(new SubItems("Fixed")); menuExepenses.Add(new SubItems("Variable")); var item3 = new itemMenu("Expenses", menuExepenses, PackIconKind.ShoppingBasket); var menuFinacial = new List <SubItems>(); menuFinacial.Add(new SubItems("Cash Flow")); var item4 = new itemMenu("Finacial", menuFinacial, PackIconKind.ScaleBathroom); Menu.Children.Add(new NewUserControlMenuItem(item6, this)); Menu.Children.Add(new NewUserControlMenuItem(item1, this)); Menu.Children.Add(new NewUserControlMenuItem(item2, this)); Menu.Children.Add(new NewUserControlMenuItem(item3, this)); Menu.Children.Add(new NewUserControlMenuItem(item4, this)); }
private void onexecmenu(object obj) { if (obj == null) { return; } itemMenu itm = ((itemMenu)obj); if (itm.id == "1") { direcionador.TelaDominiosLista(Navigation); } //ItemsDominioPage string x = obj.GetType().ToString(); }
public home() { InitializeComponent(); Title = "Menu"; BackgroundColor = Color.FromHex(ivy.Config.config.corpadrao); var plainButton = new Style(typeof(Button)) { Setters = { new Setter { Property = Button.BackgroundColorProperty, Value = Color.FromHex("#ddd") }, new Setter { Property = Button.TextColorProperty, Value = Color.Black }, new Setter { Property = Button.BorderRadiusProperty, Value = 0 }, new Setter { Property = Button.FontSizeProperty, Value = 40 } } }; var controlGrid = new Grid { RowSpacing = 1, ColumnSpacing = 1 }; controlGrid.BackgroundColor = Color.FromHex(ivy.Config.config.corpadrao); controlGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); controlGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); List <itemMenu> menu = MOC_MENU(); int botoes = menu.Count; int BotoesPorLinha = 2; int Linhas = botoes / BotoesPorLinha; if (menu.Count % BotoesPorLinha > 0) { Linhas++; } for (int L = 0; L < Linhas; L++) { controlGrid.RowDefinitions.Add( new RowDefinition { Height = new GridLength(0.2, GridUnitType.Auto) } ); for (int C = 0; C < (BotoesPorLinha); C++) { if (L * BotoesPorLinha + C >= botoes) { break; } itemMenu itm = menu[L * BotoesPorLinha + C]; Action <object> execMenu; execMenu = onexecmenu; Button ctrl = new Button() { FontSize = 18, FontAttributes = FontAttributes.Bold, //Opacity =0, ContentLayout = new ButtonContentLayout(ImagePosition.Top, 1), Text = itm.texto, TextColor = Color.FromHex(ivy.Config.config.corpadrao), Style = plainButton, Image = (FileImageSource)(ImageSource.FromFile(itm.imagem)), HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, BorderWidth = 5, BorderRadius = 5, BorderColor = Color.White, InputTransparent = true, BackgroundColor = Color.White, Command = new Command(execMenu), CommandParameter = itm }; /* * Button ctrl = new Button() * { * * FontSize = 24, * //Opacity =0, * ContentLayout = new ButtonContentLayout(ImagePosition.Top, 1), * Text = new StringBuilder("").Append(L.ToString()).Append(",").Append(C.ToString()).ToString(), * Style = plainButton, * Image = (FileImageSource)(ImageSource.FromFile("ic_dominio.png")), * HorizontalOptions = LayoutOptions.FillAndExpand, * VerticalOptions = LayoutOptions.CenterAndExpand, * BorderWidth = 5, * BorderRadius = 5, * BorderColor= Color.White, * InputTransparent = true, * BackgroundColor = Color.White, * Command = new Command(param) * }; */ controlGrid.Children.Add(ctrl, C, L); } } stkmenu.Children.Add(controlGrid); ScrollView Scroll = new ScrollView { Orientation = ScrollOrientation.Vertical }; Scroll.Content = stkmenu; }