Skip to content

Commit

Permalink
Example code for RepeatButton
Browse files Browse the repository at this point in the history
  • Loading branch information
NotYoojun committed Dec 19, 2024
1 parent b6fd510 commit 82f1a3b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
Title="Repeat Button Page"
d:DesignWidth="800"
mc:Ignorable="d">
mc:Ignorable="d" Loaded="Page_Loaded">
<StackPanel>
<local:ControlExample HeaderText="A simple RepeatButton with text content.">
<local:ControlExample x:Name="Example1" HeaderText="A simple RepeatButton with text content.">
<local:ControlExample.Resources>
<ui:BindingProxy x:Key="DisableControl1" Value="{x:Reference DisableControl1}" />
</local:ControlExample.Resources>
Expand All @@ -29,15 +29,9 @@
</StackPanel>

<local:ControlExample.Options>
<CheckBox x:Name="DisableControl1" Content="Disable RepeatButton" />
<CheckBox x:Name="DisableControl1" Content="Disable RepeatButton" Click="DisableControl1_Click"/>
</local:ControlExample.Options>

<local:ControlExample.Xaml>
<sys:String>
&lt;RepeatButton Content=&quot;Click and hold&quot; Click=&quot;RepeatButton_Click&quot; $(IsEnabled)/&gt;
</sys:String>
</local:ControlExample.Xaml>

<local:ControlExample.Substitutions>
<local:ControlExampleSubstitution
Key="IsEnabled"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ public RepeatButtonPage()
InitializeComponent();
}

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

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

private static int _clicks = 0;
private void RepeatButton_Click(object sender, RoutedEventArgs e)
{
Expand All @@ -36,10 +46,14 @@ private void RepeatButton_Click(object sender, RoutedEventArgs e)

public void UpdateExampleCode()
{

Example1.Xaml = Example1Xaml;
}

#endregion
public string Example1Xaml => $@"
<RepeatButton x:Name=""Control1""
Content=""Click and hold"" IsEnabled=""{!DisableControl1.IsChecked}"" />
";

#endregion
}
}

0 comments on commit 82f1a3b

Please sign in to comment.