refactor: consolidate common media context menu items into MediaMenuFlyout - #1076
Draft
huynhsontung wants to merge 4 commits into
Draft
refactor: consolidate common media context menu items into MediaMenuFlyout#1076huynhsontung wants to merge 4 commits into
huynhsontung wants to merge 4 commits into
Conversation
…lyout - Introduce MediaMenuFlyout control to centralize standard media context menu items (Play, Play Next, Add to Queue, Add to Playlist, Open With, Open in File Explorer, Properties, Set Playback Options). - Handle dynamic play/pause icons and labels, RTL icon mirroring, and media item command parameter resolution directly in C#. - Support page-specific extension items defined within XAML content. - Refactor SongsPage, AllVideosPage, FolderViewPage, and FolderListViewPage to use MediaMenuFlyout.
Consolidate duplicated MenuFlyout XAML definitions into the reusable MediaMenuFlyout component across AlbumDetailsPage, ArtistDetailsPage, HomePage, PlaylistDetailsPage, SearchResultPage, SongSearchResultPage, and VideoSearchResultPage. Also removes redundant RTL icon visual states.
…nd MediaMenuFlyout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context & Motivation
Across various media listing pages (
SongsPage,AllVideosPage,FolderViewPage,FolderListViewPage,HomePage,AlbumDetailsPage,ArtistDetailsPage,PlaylistDetailsPage,SearchResultPage,SongSearchResultPage,VideoSearchResultPage), the context menu (ItemFlyout) repeated dozens of lines of identical XAML definitions for common media actions (Play, Play Next, Add to Queue, Add to Playlist, Open With, Open in File Explorer, Properties, Set Playback Options).In addition to XAML boilerplate duplication, each page had to declare visual state setters to mirror glyphs for Right-to-Left (RTL) languages.
Key Changes & Impact
MediaMenuFlyoutCustom Control: SubclassesMenuFlyoutto encapsulate standard media items natively in C#, handling commands, item parameters (unwrappingStorageItemViewModeltoMediaViewModelas needed), dynamic play/pause icons, and RTL glyph mirroring automatically.<controls:MediaMenuFlyout>in XAML (e.g.ShowAlbum,ShowArtist,RemoveCommand,SelectCommand), which are dynamically appended in the correct order.<MenuFlyout x:Key="ItemFlyout">declarations across 11 media views with<controls:MediaMenuFlyout>, stripping hundreds of lines of duplicated XAML and removing redundant RTLVisualStatesetters.Testing & Verification
dotnet run --project Screenbox.Core.Tests/Screenbox.Core.Tests.csproj(all 26 tests passed).