- 1 year ago
UWP: Disabling Tooltips for MediaTransportControls - Element
In UWP (Universal Windows Platform), you can disable tooltips for the MediaTransportControls
element by customizing the control template and removing the tooltip from it. To achieve this, you need to modify the XAML markup for the MediaTransportControls
to remove the tooltip parts.
Here's how you can do it:
Open your XAML file that contains the
MediaTransportControls
element.Find the
MediaTransportControls
element in the XAML. It should look something like this:
xml<MediaElement Name="mediaElement" Width="640" Height="480">
<MediaElement.TransportControls>
<MediaTransportControls />
</MediaElement.TransportControls>
</MediaElement>
To customize the
MediaTransportControls
, you need to extract its default template. Right-click on theMediaTransportControls
element and choose "Edit Template" -> "Edit a Copy." This will generate a default style for theMediaTransportControls
in your XAML resources.Inside the generated style, find the
<ToolTipService.ToolTip>
element and remove it. The tooltip is typically defined under theThumb
element or some other visual elements used in theMediaTransportControls
.
For example, you might find something like this:
xml<Thumb x:Name="thumb" Width="50" Height="50" HorizontalAlignment="Center" VerticalAlignment="Center">
<ToolTipService.ToolTip>
<!-- ToolTip content here -->
</ToolTipService.ToolTip>
</Thumb>
Remove the entire <ToolTipService.ToolTip>
element:
xml<Thumb x:Name="thumb" Width="50" Height="50" HorizontalAlignment="Center" VerticalAlignment="Center">
<!-- No ToolTip -->
</Thumb>
- Apply the modified style to your
MediaTransportControls
. In the XAML where you defined theMediaTransportControls
, add theStyle
attribute and set it to the name of the modified style:
xml<MediaElement Name="mediaElement" Width="640" Height="480">
<MediaElement.TransportControls>
<MediaTransportControls Style="{StaticResource CustomMediaTransportControlsStyle}" />
</MediaElement.TransportControls>
</MediaElement>
Remember to replace CustomMediaTransportControlsStyle
with the name you gave to the modified style in your XAML resources.
By removing the tooltip parts from the MediaTransportControls
control template, you effectively disable tooltips for it. Save your XAML file, and now the MediaTransportControls
should no longer show any tooltips.