home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 2
Skins and Design
BlueVision
Blue Vision
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="osre" data-source="post: 1127604" data-attributes="member: 150866"><p>I made a working version to change menu items on group item selection change:</p><p>The HomeMenuModel needs to be modified as follows:</p><p>[CODE=C#]...</p><p>// additional using</p><p>using MediaPortal.UI.SkinEngine.MpfElements;</p><p>...</p><p>// modified CreateMenuGroupItems: remove command and add AdditionalProperty with key.</p><p>protectedvoid CreateMenuGroupItems()</p><p>{</p><p>_mainMenuGroupList.Clear();</p><p>if (_menuSettings !=null)</p><p>{</p><p>int idx =0;</p><p>foreach (string group in _menuSettings.MainMenuGroupNames)</p><p>{</p><p>string groupName = group;</p><p>var groupItem =newListItem(Consts.KEY_NAME, groupName)</p><p>{</p><p>Selected = idx == _menuSettings.DefaultIndex</p><p>};</p><p>groupItem.AdditionalProperties.Add("NameKey", groupName);</p><p>_mainMenuGroupList.Add(groupItem);</p><p>idx ++;</p><p>}</p><p>}</p><p>_mainMenuGroupList.FireChange();</p><p>}</p><p>...</p><p>// new selection changed handler, which sets the group according to the key we stored in the group item above</p><p>publicvoid OnGroupItemSelectionChanged(object sender, SelectionChangedEventArgs e)</p><p>{</p><p>var item = e.FirstAddedItem asListItem;</p><p>if (item !=null)</p><p>{</p><p>SetGroup((string)item.AdditionalProperties["NameKey"]);</p><p>}</p><p>}</p><p>[/CODE]</p><p>And the XAML (master:bare.xaml) looks like this:</p><p>[CODE=C#]...</p><p><!-- Group tabs: remove commnd bridtge and add SelectionChanged event handler --></p><p><ListView x:Name="GroupList" Style="{ThemeResource HomeGroupListViewStyle}" Grid.Column="1"</p><p>VerticalAlignment="Stretch"</p><p>IsEnabled="{Binding Source={StaticResource MenuModel},Path=!IsMenuOpen}"</p><p>ItemsSource="{Binding Source={StaticResource MenuModel},Path=MainMenuGroupList,Mode=OneTime}"</p><p>SelectionChanged="{CommandStencil Source={StaticResource MenuModel},Path=OnGroupItemSelectionChanged}"></p><p></ListView></p><p>...[/CODE]</p><p>Attached are both files, but please make sure you have no changes on your own.</p><p>If you like my changes I can also push them to GitHub.</p></blockquote><p></p>
[QUOTE="osre, post: 1127604, member: 150866"] I made a working version to change menu items on group item selection change: The HomeMenuModel needs to be modified as follows: [CODE=C#]... // additional using using MediaPortal.UI.SkinEngine.MpfElements; ... // modified CreateMenuGroupItems: remove command and add AdditionalProperty with key. protectedvoid CreateMenuGroupItems() { _mainMenuGroupList.Clear(); if (_menuSettings !=null) { int idx =0; foreach (string group in _menuSettings.MainMenuGroupNames) { string groupName = group; var groupItem =newListItem(Consts.KEY_NAME, groupName) { Selected = idx == _menuSettings.DefaultIndex }; groupItem.AdditionalProperties.Add("NameKey", groupName); _mainMenuGroupList.Add(groupItem); idx ++; } } _mainMenuGroupList.FireChange(); } ... // new selection changed handler, which sets the group according to the key we stored in the group item above publicvoid OnGroupItemSelectionChanged(object sender, SelectionChangedEventArgs e) { var item = e.FirstAddedItem asListItem; if (item !=null) { SetGroup((string)item.AdditionalProperties["NameKey"]); } } [/CODE] And the XAML (master:bare.xaml) looks like this: [CODE=C#]... <!-- Group tabs: remove commnd bridtge and add SelectionChanged event handler --> <ListView x:Name="GroupList" Style="{ThemeResource HomeGroupListViewStyle}" Grid.Column="1" VerticalAlignment="Stretch" IsEnabled="{Binding Source={StaticResource MenuModel},Path=!IsMenuOpen}" ItemsSource="{Binding Source={StaticResource MenuModel},Path=MainMenuGroupList,Mode=OneTime}" SelectionChanged="{CommandStencil Source={StaticResource MenuModel},Path=OnGroupItemSelectionChanged}"> </ListView> ...[/CODE] Attached are both files, but please make sure you have no changes on your own. If you like my changes I can also push them to GitHub. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 2
Skins and Design
BlueVision
Blue Vision
Contact us
RSS
Top
Bottom