kakone / VLC.MediaElement

MediaElement clone powered by VLC
GNU Lesser General Public License v2.1
68 stars 33 forks source link

How can I change the template? #17

Closed panzur closed 7 years ago

panzur commented 7 years ago

Is there way to change the template? Can you provide an example?

kakone commented 7 years ago

Copy the vlc:MediaTransportControls default style into a ResourceDictionary in your project, and edit it like you want. Give the Style an x:Key value to identify it, like this :

<Style TargetType="vlc:MediaTransportControls" x:Key="myTransportControlsStyle">
    <!-- Style content ... -->
</Style>

Add your ResourceDictionary file in App.xaml :

<Application x:Class="MyApp.App">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Themes\MediaTransportControls.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

Add a vlc:MediaElement with vlc:MediaTransportControls to your UI. Set the Style property of the MediaTransportControls element to your custom Style resource, as shown here :

<vlc:MediaElement AreTransportControlsEnabled="True">
    <vlc:MediaElement.TransportControls>
        <vlc:MediaTransportControls Style="{StaticResource myTransportControlsStyle}" />
    </vlc:MediaElement.TransportControls>
</vlc:MediaElement>