Skip to content

Commit

Permalink
Example code for ProgressRing
Browse files Browse the repository at this point in the history
  • Loading branch information
NotYoojun committed Dec 14, 2024
1 parent 3e43035 commit 93e2d0c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
mc:Ignorable="d">
mc:Ignorable="d" Loaded="Page_Loaded">
<StackPanel>
<local:ControlExample HeaderText="An indeterminate progress ring.">
<local:ControlExample x:Name="Example1" HeaderText="An indeterminate progress ring.">
<ui:ProgressRing
Width="60"
Height="60"
Expand All @@ -25,16 +25,12 @@
Header="Toggle work"
IsOn="True"
OffContent="Do work"
OnContent="Working" />
OnContent="Working"
Toggled="ProgressToggle_Toggled"/>
</StackPanel>
</local:ControlExample.Options>
<local:ControlExample.Xaml>
<sys:String>
&lt;ProgressRing IsActive=&quot;$(IsActive)&quot; /&gt;
</sys:String>
</local:ControlExample.Xaml>
</local:ControlExample>
<local:ControlExample HeaderText="A determinate progress ring.">
<local:ControlExample x:Name="Example2" HeaderText="A determinate progress ring.">
<StackPanel x:Name="Control2" Orientation="Horizontal">
<ui:ProgressRing
x:Name="ProgressRing2"
Expand All @@ -52,13 +48,9 @@
Maximum="100"
Minimum="0"
SpinButtonPlacementMode="Inline"
Value="{Binding Value, ElementName=ProgressRing2, Mode=TwoWay}" />
Value="{Binding Value, ElementName=ProgressRing2, Mode=TwoWay}"
ValueChanged="ProgressValue_ValueChanged"/>
</StackPanel>
<local:ControlExample.Xaml>
<sys:String>
&lt;ProgressRing Width=&quot;60&quot; Height=&quot;60&quot; Value=&quot;$(DeterminateProgressValue)&quot; IsIndeterminate=&quot;False&quot;/&gt;
</sys:String>
</local:ControlExample.Xaml>
</local:ControlExample>
</StackPanel>
</ui:Page>
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,40 @@ public ProgressRingPage()
InitializeComponent();
}

private void Page_Loaded(object sender, RoutedEventArgs e)
{
UpdateExampleCode();
}

private void ProgressToggle_Toggled(object sender, RoutedEventArgs e)
{
UpdateExampleCode();
}

private void ProgressValue_ValueChanged(NumberBox sender, NumberBoxValueChangedEventArgs args)
{
UpdateExampleCode();
}


#region Example Code

public void UpdateExampleCode()
{
if (!this.IsLoaded) return;

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

public string Example1Xaml => $@"
<ui:ProgressRing IsActive=""{ProgressToggle.IsOn}"" />
";

public string Example2Xaml => $@"
<ui:ProgressRing Value=""{ProgressValue.Value}""/>
";

#endregion

}
Expand Down

0 comments on commit 93e2d0c

Please sign in to comment.