Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2090
ApplicationMenu2010: Create Views on demand
posted

Hello,

I am using xamRibbon and ApplicationMenu2010 in a MVVM application. In order to put configuration items (like user setting, system wide setting etc.) into the ApplicationMenu2010 I see following options:

1. Put the content directly in XAML of the shell window

Pro: Clear and easy

Con: The whole XAML loading is done at startup of the shell and the configuration might not be used in the current session.

2. Add  the menu items in code behind:

Pro: Not loaded at startup

Con: On _OnOpened() all items are created -> slow

private void ApplicationMenu2010_OnOpened(object sender, RoutedEventArgs e)
{
	ApplicationMenu2010 menu = (ApplicationMenu2010)sender;
if (menu.Items.Count > 0) { return; }

menu.Items.Add(new ApplicationMenu2010Item { Header = "Einstellungen" });

menu.Items.Add(new ApplicationMenu2010Item { Header = "Benutzereinstellungen", Content = new vBenutzerEinstellungen(new vmBenutzerEinstellungen()) });
menu.Items.Add(new ApplicationMenu2010Item { Header = "Systemweite Farben", Content = new vSystemweiteFarben(new vmSystemweiteFarben()) });
menu.Items.Add(new ApplicationMenu2010Item { Header = "Systemweite Einstellungen", Content = new vGlobalConfig(new vmGlobalConfig()) });
}

I wonder if there is a possibility to create only the currently clicked it at the time its needed.

var pwditem = new ApplicationMenu2010Item { Header = "Test", Style = (Style)GlobalStyles.Instance["ApplicationMenuItem"] };
	pwditem.SetBinding(ApplicationMenu2010Item.CommandProperty, new Binding("OpenConfigurationItem"));
	menu.Items.Add(pwditem);

private vTest OpenConfigurationItem()
{
	View vTest;
	vTest= this.Container.GetInstance<AppFact.Infrastructure.MVVM.ViewBase>("vTest");
         return vTest;
}

I want to create the different views with configuration records only when they are really neded.

In addition: Is there a way to mark a ApplicationMenu2010Item as header without click function?

Thanks

Niko

Parents Reply Children
No Data