Skip to content

Commit

Permalink
Example code for RadioButtons
Browse files Browse the repository at this point in the history
  • Loading branch information
NotYoojun committed Dec 19, 2024
1 parent cc6b471 commit 6468437
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,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">
<ikw:SimpleStackPanel>
<local:ControlExample HeaderText="A group of radio buttons.">
<local:ControlExample x:Name="Example1" HeaderText="A group of radio buttons.">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
Expand All @@ -32,7 +32,7 @@
</Grid>
</local:ControlExample>

<local:ControlExample HeaderText="Two groups of radio buttons.">
<local:ControlExample x:Name="Example2" HeaderText="Two groups of radio buttons.">
<StackPanel>
<ui:RadioButtons
x:Name="BackgroundRadioButtons"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Windows.Controls;
using System.Windows;
using System.Windows.Controls;

namespace iNKORE.UI.WPF.Modern.Gallery.ControlPages
{
Expand All @@ -9,14 +10,50 @@ public RadioButtonsPage()
InitializeComponent();
}

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

#region Example Code

public void UpdateExampleCode()
{

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

#endregion
public string Example1Xaml => $@"
<ui:RadioButtons x:Name=""Options"" Header=""Options:"">
<!-- A RadioButton group. -->
<RadioButton x:Name=""Option1RadioButton"" Content=""Option 1"" />
<RadioButton x:Name=""Option2RadioButton"" Content=""Option 2"" />
<RadioButton x:Name=""Option3RadioButton"" Content=""Option 3"" />
</ui:RadioButtons>
";

public string Example2Xaml => $@"
<ui:RadioButtons
x:Name=""BackgroundRadioButtons""
Header=""Background""
MaxColumns=""4"">
<RadioButton Content=""Green"" />
<RadioButton Content=""Yellow"" />
<RadioButton Content=""Blue"" />
<RadioButton Content=""White"" IsChecked=""True"" />
</ui:RadioButtons>
<ui:RadioButtons
x:Name=""BorderBrushRadioButtons""
Header=""BorderBrush""
MaxColumns=""4""
SelectedIndex=""1"">
<sys:String>Green</sys:String>
<sys:String>Yellow</sys:String>
<sys:String>Blue</sys:String>
<sys:String>White</sys:String>
</ui:RadioButtons>
";

#endregion
}
}

0 comments on commit 6468437

Please sign in to comment.