Exemplo n.º 1
0
        private static FrameworkElement CreateViewForSeparator(IMenuItem menuItem)
        {
            var separator = new Separator();

            WeightExtension.SetWeight(separator, menuItem.Weight);
            return(separator);
        }
Exemplo n.º 2
0
        private static FrameworkElement CreateMenuItemView(IMenuItem menuItem)
        {
            var menuView = new System.Windows.Controls.MenuItem()
            {
                Command          = menuItem.Command,
                CommandParameter = menuItem.CommandParameter,
                Icon             = menuItem.Icon,

                // Note: Assigning Text to Header is not advised since WPF by default uses “Label” which does not display underscores correctly.
                // See : http://stackoverflow.com/questions/9684619/label-doesnt-display-character
                Header = new TextBlock()
                {
                    Text = menuItem.Text
                },
            };

            WeightExtension.SetWeight(menuView, menuItem.Weight);
            return(menuView);
        }