Commit dec248e
Update MediaElement Transport Controls for Windows (#2329)
* Add custom transport controls and resource dictionary
Introduced a new embedded resource, `ResourceDictionary.windows.xaml`, in the `CommunityToolkit.Maui.MediaElement.csproj` project file.
Updated `MauiMediaElement.windows.cs`:
- Imported new namespaces.
- Added `CustomTransportControls` field and methods for loading resource dictionary and applying custom styles.
- Updated constructor to load resource dictionary and set custom transport controls.
- Added `LoadResourceDictionary`, `ApplyCustomStyle`, and `SetTransportControls` methods.
- Updated `Dispose` method to handle custom transport controls.
- Removed `OnMediaPlayerElementPointerMoved` method and related code.
- Updated `OnFullScreenButtonClick` method to remove fullscreen button references.
Updated `MediaManager.windows.cs`:
- Disabled `SystemMediaTransportControls` in `CreatePlatformView`.
Added `CustomTransportControls` class in `CommunityToolkit.Maui.Primitives`:
- Imported necessary namespaces.
- Defined `FullScreenButton` property.
- Implemented `OnTemplateLoaded` event.
- Overrode `OnApplyTemplate` method to add full-screen button.
- Added `FullScreenButton_Click` event handler.
- Introduced `isFullScreen` field to track full-screen state.
* Reorder AppBarSeparator in ResourceDictionary.xaml
Moved RightSeparator before PlaybackRateButton in ResourceDictionary.windows.xaml. Added RightSeparator with Height='0', Width='0', and Margin='0,0'. Reordered properties of PlaybackRateButton without changing values. Removed original RightSeparator after PlaybackRateButton.
* Re-add and enhance media control styles and templates
Re-added various properties and elements to styles and templates in `ResourceDictionary.windows.xaml` to ensure consistent UI appearance and behavior. Added new buttons like `ZoomButton` and `CastButton` to the media controls command bar. Enhanced `customTransportcontrols` and `CommandBarStyle` with additional properties.
* Update layout properties and add corner radius to Grid
Removed the `UseLayoutRounding` property and adjusted the `Margin`
property from `0,0,0,20` to `0,0,0,10`. Added `VerticalContentAlignment`
set to `Center` and `VerticalAlignment` set to `Bottom`. Introduced
`CornerRadius` of `8,8,8,8` to the `Grid` element in the
`ResourceDictionary.windows.xaml` file.
* Refactor CustomTransportControls class and clean up code
- Cleaned up `using` directives by removing redundant `using CommunityToolkit.Maui.Core;` and reordering the remaining directives.
- Changed `CustomTransportControls` class from public sealed to sealed partial.
- Removed XML documentation comments for `CustomTransportControls` class and its members.
- Changed `FullScreenButton` property from nullable `AppBarButton` with a private setter to non-nullable `AppBarButton` initialized with a new instance.
- Removed null check for `FullScreenButton` in `FullScreenButton_Click` method as `FullScreenButton` is no longer nullable.
* Fix volume slider bug with Should Mute
---------
Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com>
Co-authored-by: Víctor Hugo García Hernández <vhugogarcia@users.noreply.github.com>
Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>1 parent 5979390 commit dec248e
File tree
5 files changed
+920
-62
lines changed- src/CommunityToolkit.Maui.MediaElement
- Primitives
- Views
5 files changed
+920
-62
lines changedLines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
84 | 89 | | |
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
0 commit comments