2026-01-26 18:56:53 +09:00

38 lines
2.8 KiB
XML

<UserControl x:Class="AuroraUIComponent.UserControls.UCRadioGroup"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:msh ="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:local="clr-namespace:AuroraUIComponent.UserControls"
xmlns:uic="clr-namespace:AuroraUIComponent"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" x:Name="ucRadioGroup">
<ItemsControl x:Name="RadioButtonsGroup" ItemsPanel="{DynamicResource StackHorizontal}"
ItemsSource="{Binding ItemList, Mode=TwoWay, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:UCRadioGroup}}">
<ItemsControl.Resources>
<ItemsPanelTemplate x:Key="StackHorizontal">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Stretch"
Margin="{Binding GroupMargin,Mode=TwoWay, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:UCRadioGroup}}" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="StackVertical">
<StackPanel Orientation="Vertical" VerticalAlignment="Stretch" HorizontalAlignment="Center"
Margin="{Binding GroupMargin,Mode=TwoWay, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:UCRadioGroup}}" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="Uniform">
<UniformGrid Rows="1" VerticalAlignment="Center" HorizontalAlignment="Stretch"
Margin="{Binding GroupMargin, Mode=TwoWay, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:UCRadioGroup}}"/>
</ItemsPanelTemplate>
</ItemsControl.Resources>
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton x:Name="rBtn" GroupName ="{Binding GroupBoxName,Mode=TwoWay, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:UCRadioGroup}}"
Content="{Binding}" Click="RadioButton_Click" Loaded="UCRadioGroup_Loaded"
Margin="{Binding RadioButtonMargin, Mode=TwoWay, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:UCRadioGroup}}"
msh:RadioButtonHelper.OuterEllipseCheckedStroke="{DynamicResource BLGRedCustomDark}"
msh:RadioButtonHelper.OuterEllipseCheckedStrokePointerOver="{DynamicResource BLGRed}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</UserControl>