This project is read-only.

Adding links in code dynamically

Mar 1, 2013 at 4:54 AM
Edited Mar 1, 2013 at 5:54 AM
The static links work fine, but how does one add the links in code ?
I am trying to modify the main page sample links to add the links dynamically in code with no success.

Would you recommend using DataBinding approach instead of adding elements in code?

Do you have some simple samples showing various scenarios?

I have tried the following code, but the "Basic Page" link is not displayed:
private void ModernWindow_Loaded_1(object sender, RoutedEventArgs e)
            FirstFloor.ModernUI.Presentation.Link link = new FirstFloor.ModernUI.Presentation.Link() { DisplayName = "Basic Page", Source = new Uri("Pages/BasicPage.xaml", UriKind.Relative) };
Thank you
Mar 2, 2013 at 5:28 PM
Edited Mar 2, 2013 at 5:29 PM
Good point, the ModernMenu didn't support dynamic adding and removing groups and links. I just checked in a ModernMenu update that does support dynamic changes (both in code and using DataBinding). A new demo page in the sample app (Controls > Modern Controls > ModernMenu) demonstrates the updated ModernMenu.

You can get the latest ModernMenu by getting the latest source code.
Mar 5, 2013 at 9:28 PM
I downloaded the Modern UI 1.0.1 from Downloads , and looked at the Source but can't find the path or the sample you mentioned :
sample app (Controls > Modern Controls > ModernMenu
Where can I find it?
Mar 5, 2013 at 9:52 PM
ModernMenu update not a release yet. It's available in the source code. You need to get the latest and compile it yourself.