Files
Shrlalgo.RvKits/AntdWpfDemo/Views/RadioButtonView.xaml
2025-07-31 20:12:24 +08:00

100 lines
6.4 KiB
XML

<UserControl x:Class="AntDesignWPFDemo.Views.RadioButtonView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:antd="https://github.com/ShrlAlgo/AntDesignWPF"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewmodels="clr-namespace:AntDesignWPFDemo.ViewModels"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=viewmodels:RadioButtonViewModel}"
d:DesignHeight="600"
d:DesignWidth="930">
<ScrollViewer>
<Grid Margin="16,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel>
<Label Content="Radio" Style="{StaticResource Ant.H1}" />
<TextBlock Style="{StaticResource Ant.P}" Text="Radio." />
<Label Content="When To Use" Style="{StaticResource Ant.H2}" />
<TextBlock Style="{StaticResource Ant.P}"
Text="Used to select a single state in multiple options.&#x0a;The difference between Select is that Radio is visible to user and can facilitate the comparison of choice, which makes there shouldn't be too many of them."
TextWrapping="Wrap" />
<Label Content="Examples" Style="{StaticResource Ant.H2}" />
</StackPanel>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Margin="8,0">
<antd:CodeBox Title="Basic">
<antd:CodeBox.Description>The simplest use.</antd:CodeBox.Description>
<antd:CodeBox.Content>
<RadioButton Content="Radio" />
</antd:CodeBox.Content>
<antd:CodeBox.Code>&lt;ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Themes/Theme.xaml" /&gt;\n
&lt;ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Styles/antd.xaml" /&gt;\n\n
&lt;RadioButton Content="Radio" /&gt;</antd:CodeBox.Code>
</antd:CodeBox>
<antd:CodeBox Title="Radio Group">
<antd:CodeBox.Description>A group of radio components.</antd:CodeBox.Description>
<!-- <antd:CodeBox.Content>
<antd:RadioButtonGroup Orientation="Vertical">
<RadioButton Content="A" />
<RadioButton Content="B" GroupName="A" />
<RadioButton Content="C" GroupName="A" />
<RadioButton Content="D" />
</antd:RadioButtonGroup>
</antd:CodeBox.Content> -->
<antd:CodeBox.Code>&lt;ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Themes/Theme.xaml" /&gt;\n
&lt;ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Styles/antd.xaml" /&gt;\n\n
&lt;RadioButton Content="Radio" /&gt;</antd:CodeBox.Code>
</antd:CodeBox>
<antd:CodeBox Title="RadioGroup group - ItemsSource">
<antd:CodeBox.Description>Render radios by configuring `ItemsSource`.</antd:CodeBox.Description>
<antd:CodeBox.Content>
<antd:RadioButtonGroup DisplayMemberPath="Label"
ItemsSource="{Binding Items}"
Orientation="Vertical" />
</antd:CodeBox.Content>
<antd:CodeBox.Code>&lt;ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Themes/Theme.xaml" /&gt;\n
&lt;ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Styles/antd.xaml" /&gt;\n\n
&lt;RadioButton Content="Radio" /&gt;</antd:CodeBox.Code>
</antd:CodeBox>
</StackPanel>
<StackPanel Grid.Column="1" Margin="8,0">
<antd:CodeBox Title="Disabled">
<antd:CodeBox.Description>Radio unavailable.</antd:CodeBox.Description>
<antd:CodeBox.Content>
<StackPanel>
<RadioButton Margin="0,0,0,8"
Content="Radio"
IsEnabled="{Binding IsEnabled}" />
<RadioButton Content="Radio"
IsChecked="True"
IsEnabled="{Binding IsEnabled}" />
<antd:AntButton x:Name="Toggle"
Margin="0,20,0,0"
Content="Toggle disabled"
Variant="Solid" />
</StackPanel>
</antd:CodeBox.Content>
<antd:CodeBox.Code>&lt;ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Themes/Theme.xaml" /&gt;\n
&lt;ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Styles/antd.xaml" /&gt;\n\n
&lt;StackPanel&gt;\n
\t&lt;RadioButton Content="Radio" IsEnabled="{Binding IsEnabled}" Margin="0 0 0 8" /&gt;\n
\t&lt;RadioButton Content="Radio" IsEnabled="{Binding IsEnabled}" IsChecked="True" /&gt;\n
\t&lt;antd:Button x:Name="Toggle" Type="Primary" Content="Toggle disabled" Margin="0 20 0 0" /&gt;\n
&lt;/StackPanel&gt;\n</antd:CodeBox.Code>
</antd:CodeBox>
</StackPanel>
</Grid>
</Grid>
</ScrollViewer>
</UserControl>