This project is read-only.

[Solved] LinkGroupCollection and MVVM

Sep 20, 2013 at 5:22 PM
Edited Sep 20, 2013 at 6:04 PM
Hey,

I hope someone can help me. I using MUI at firsttime and so I need some basic help.

I have create a LinkGroupCollection Property in my ViewModel.

Public Property MenuLinkGroups As FirstFloor.ModernUI.Presentation.LinkGroupCollection
        Set(value As FirstFloor.ModernUI.Presentation.LinkGroupCollection)
            If value IsNot _MenuLinkGroups Then
                _MenuLinkGroups = value
                Me.OnPropertyChanged("MenuLinkGroups")
            End If
        End Set
        Get
            Return _MenuLinkGroups
        End Get
    End Property
    Private _MenuLinkGroups As FirstFloor.ModernUI.Presentation.LinkGroupCollection

Public Function GetMuiMenuLinkGroups() As FirstFloor.ModernUI.Presentation.LinkGroupCollection

        Dim _muiMenu As New FirstFloor.ModernUI.Presentation.LinkGroupCollection
        Dim _newMuiGroup As FirstFloor.ModernUI.Presentation.LinkGroup
        Dim _newMuiLink As FirstFloor.ModernUI.Presentation.Link


        For Each mnuGroup As Entities.MenuGroup In OlbSections

            _newMuiGroup = New FirstFloor.ModernUI.Presentation.LinkGroup
            With _newMuiGroup
                .DisplayName = mnuGroup.Name
                .GroupName = mnuGroup.Name
            End With

            For Each mnuEntry As Entities.MenuEntry In mnuGroup.MenuEntries

                _newMuiLink = New FirstFloor.ModernUI.Presentation.Link
                With _newMuiLink
                    .DisplayName = mnuEntry.Text
                    .Source = New Uri("/Pages/MUIPages.xaml", UriKind.Relative)
                End With

                _newMuiGroup.Links.Add(_newMuiLink)

            Next

            _muiMenu.Add(_newMuiGroup)

        Next

        Return _muiMenu

    End Function
In my XAML I have following code
<mui:ModernWindow x:Class="ClientMUIView"
                  
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:mui="http://firstfloorsoftware.com/ModernUI"

    Title="ClientMUIView" Height="500" Width="800"
                  
    MenuLinkGroups="{Binding MenuLinkGroups}">
    
    
</mui:ModernWindow>
My Problem is: Only one LinkGroup is be showen - but 5 LinkGroups are in the MenuLinkGroups-Property. What are my misstake?

Solution: I have different .GroupNames - if they all the same, than it works