Skip to content

Commit

Permalink
Example code for MediaPlayerElement
Browse files Browse the repository at this point in the history
  • Loading branch information
NotYoojun committed Nov 17, 2024
1 parent 352b342 commit ab06141
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@
Source="{Binding Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource RelativeToAbsoluteConverter}}"
Tag="Assets/SampleMedia/ladybug.wmv" />
</local:ControlExample.Example>
<local:ControlExample.Xaml>
<sys:String xml:space="preserve">
&lt;ui:MediaPlayerElement Source=&quot;/Assets/SampleMedia/ladybug.wmv&quot;
MaxWidth=&quot;400&quot;
AutoPlay=&quot;False&quot;
AreTransportControlsEnabled=&quot;True&quot; /&gt;
</sys:String>
</local:ControlExample.Xaml>
</local:ControlExample>
<local:ControlExample x:Name="Example2" HeaderText="A MediaPlayerElement that autoplays the video.">
<local:ControlExample.Example>
Expand All @@ -39,13 +31,6 @@
Source="{Binding Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource RelativeToAbsoluteConverter}}"
Tag="Assets/SampleMedia/fishes.wmv" />
</local:ControlExample.Example>
<local:ControlExample.Xaml>
<sys:String xml:space="preserve">
&lt;ui:MediaPlayerElement Source=&quot;/Assets/SampleMedia/fishes.wmv&quot;
MaxWidth=&quot;400&quot;
AutoPlay=&quot;True&quot; /&gt;
</sys:String>
</local:ControlExample.Xaml>
</local:ControlExample>
</StackPanel>
</ui:Page>
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,27 @@ public partial class MediaPlayerElementPage : Page
public MediaPlayerElementPage()
{
InitializeComponent();
UpdateExampleCode();
}

#region Example Code

public void UpdateExampleCode()
{

Example1.Xaml = Example1Xaml;
Example2.Xaml = Example2Xaml;
}

public string Example1Xaml => $@"
<ui:MediaPlayerElement AreTransportControlsEnabled=""True"" AutoPlay=""False"" Tag=""Assets/SampleMedia/ladybug.wmv""
Source=""{{Binding Tag, RelativeSource={{RelativeSource Self}}, Converter={{StaticResource RelativeToAbsoluteConverter}}}}"" />
";

public string Example2Xaml => $@"
<ui:MediaPlayerElement AutoPlay=""True"" Tag=""Assets/SampleMedia/fishes.wmv""
Source=""{{Binding Tag, RelativeSource={{RelativeSource Self}}, Converter={{StaticResource RelativeToAbsoluteConverter}}}}"" />
";

#endregion

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,12 @@ private CodeColorizer GenerateRichTextFormatter()

private void CopyCodeButton_Click(object sender, RoutedEventArgs e)
{
Clipboard.SetText(actualCode);

VisualStateManager.GoToState(this, "ConfirmationDialogVisible", false);
try
{
Clipboard.SetText(actualCode);
VisualStateManager.GoToState(this, "ConfirmationDialogVisible", false);
}
catch { }

// Automatically close teachingtip after 1 seconds
this.RunOnUIThread(async () =>
Expand Down

0 comments on commit ab06141

Please sign in to comment.