Separation of menu items (1 Viewer)

Albert

MP2 Developer
  • Premium Supporter
  • February 18, 2008
    1,297
    1,130
    45
    Freiburg im Breisgau, Germany
    Home Country
    Germany Germany
    Hi all,
    morpheus wrote a PM about how we could separate different kinds of menu items. I think that discussion should be public because it contains many interesting points.

    The point is, in the current MP2 system/skin, there are different kinds of menu items. There are menu items which are bound to the current workflow state (for example the menu point "Music" is bound to the "Home" workflow state), while there are other menu points which are bound to other internal states (for example the "Fullscreen Video" menu point is only visible if there is a primary player which is a video player).

    We had some discussions before that perhaps such kinds of menu items should be separated, maybe into two different menus or by displaying menu items of different kinds in a different way.

    Morpheus' PM was this:

    morpheus_xx said:
    Hi,

    after Albert's recent changes to allow different DataTemplates inside ListView styles, I made a small test in the MenuModel:

    I created two different types of ListItems and added two DataTemplates. The separation between "normal" and "global" items (I've done by checking if the "action.SourceStateId == null", which means the item can be available in any Workflow state).

    Take a look at these screenshots: ImageShack Album - 2 images

    I wanted to go even a bit further: I could imagine to have the 2 different item types in two different ListViews. In WPF you can achieve this with:

    Code:
    <CollectionViewSource Source="{StaticResource src2}" x:Key="cvs" Filter="FilterOutB"/>

    This way we could give a skin designer a quite powerful feature: One can put in some menu items in a horizontal menu, some in vertical list, or move the globals items in a kind of expandable menu a.s.o.

    Btw, it could be already done inside the MenuModel, providing two additional ItemsList, but the CollectionViewSource is more generic.

    What do you think about this idea?
    Who could implement this CollectionViewSource?
    How a separated Menu could look like?

    Bye,
    Mathias

    Now comes my answer.

    First: It's a very good idea to have different data templates for the different menu item types, although the separation between "normal" and "global" items is a bit arbitrary. The separation you have choosen (based on the "SourceStateId==null" check) is maybe the most sensible separation, but I could also imagine to separate NavigatePush/NavigatePop actions from programmatic actions (WorkflowContributor actions), as another example. There could be many other sensible ways to filter the list.

    Currently, menu items are also organized into so called "display categories" like "a-Media", "z-WorkflowContributors" etc. Those categories are currently used for two things: First to group items of the same category and second to sort the categories in the menu. If we create a way for the skin designer to filter special menu items by arbitrary expressions, he could also separate the menu items per category, for example. Maybe the skin designer could always use a separate menu for the menu items from the "z-WorkflowContributors" menu.

    What I want to say is: I wouldn't hard code the separation in the menu model. But the idea to have provide such a filter mechanism for the skin designer is very good.
     

    Smeulf

    Retired Team Member
  • Premium Supporter
  • October 27, 2010
    672
    454
    France
    Home Country
    France France
    What I want to say is: I wouldn't hard code the separation in the menu model. But the idea to have provide such a filter mechanism for the skin designer is very good.

    I agree on both Albert : good idea, and the less it's hard coded, the more flexible it is.

    If the "display categories" can be extended by a plugin, then it would be the best.

    For example, coul'd we have a "base" menu definition, a "z-WorkflowContributors" definition, and a "myplugin" definition, this last using the definition from the screen/style, or the "base" definition if nothing is specified ?

    (I hope i'm clear, not sure :confused:)

    Cheers.
     

    Albert

    MP2 Developer
  • Premium Supporter
  • February 18, 2008
    1,297
    1,130
    45
    Freiburg im Breisgau, Germany
    Home Country
    Germany Germany
    AW: Separation of menu items

    Smeulf, the "display category" is just a simple string which is defined as an XML attribute of a workflow action declaration. Thus a display category is not a first-class object which needs to be declared or even hard coded somewhere. A display category is just a simple string which exists if at least one workflow action defines that category string.

    That's the current implementation. I'm not sure if it's correct that way. It just seemed to me the simplest way to achieve a logical grouping of menu items and additionally, a sorting of those groups without the need of too much declaration overhead.

    The former system (before my display categories were introduced) was using a half-order for menu items; for each menu item, a "before" and/or an "after" attribute was defined which told the system a relative ordering of items, but which could lead to unstable sort orders, off course.
     

    Users who are viewing this thread

    Top Bottom