Forráskód Böngészése

Added RadioButton to ControlCatalog.

And added disabled style.
Steven Kirk 9 éve
szülő
commit
adf30e529d

+ 8 - 0
samples/ControlCatalog/ControlCatalog.csproj

@@ -61,6 +61,9 @@
     <Compile Include="MainWindow.xaml.cs">
       <DependentUpon>MainWindow.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Pages\RadioButtonPage.xaml.cs">
+      <DependentUpon>RadioButtonPage.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Pages\MenuPage.xaml.cs">
       <DependentUpon>MenuPage.xaml</DependentUpon>
     </Compile>
@@ -242,6 +245,11 @@
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </EmbeddedResource>
   </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Pages\RadioButtonPage.xaml">
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.

+ 1 - 0
samples/ControlCatalog/MainWindow.xaml

@@ -13,6 +13,7 @@
     <TabItem Header="DropDown"><pages:DropDownPage/></TabItem>
     <TabItem Header="LayoutTransformControl"><pages:LayoutTransformControlPage/></TabItem>
     <TabItem Header="Menu"><pages:MenuPage/></TabItem>
+    <TabItem Header="RadioButton"><pages:RadioButtonPage/></TabItem>
     <TabItem Header="Slider"><pages:SliderPage/></TabItem>
     <TabItem Header="TextBox"><pages:TextBoxPage/></TabItem>
     <TabItem Header="ToolTip"><pages:ToolTipPage/></TabItem>

+ 15 - 0
samples/ControlCatalog/Pages/RadioButtonPage.xaml

@@ -0,0 +1,15 @@
+<UserControl xmlns="https://github.com/perspex">
+  <StackPanel Orientation="Vertical" Gap="4">
+    <TextBlock Classes="h1">RadioButton</TextBlock>
+    <TextBlock Classes="h2">Allows the selection of a single option of many</TextBlock>
+
+    <StackPanel Orientation="Vertical"
+                Margin="0,16,0,0"
+                HorizontalAlignment="Center"
+                Gap="16">
+      <RadioButton IsChecked="True">Option 1</RadioButton>
+      <RadioButton>Option 2</RadioButton>
+      <RadioButton IsEnabled="False">Disabled</RadioButton>
+    </StackPanel>    
+  </StackPanel>
+</UserControl>

+ 18 - 0
samples/ControlCatalog/Pages/RadioButtonPage.xaml.cs

@@ -0,0 +1,18 @@
+using Perspex.Controls;
+using Perspex.Markup.Xaml;
+
+namespace ControlCatalog.Pages
+{
+    public class RadioButtonPage : UserControl
+    {
+        public RadioButtonPage()
+        {
+            this.InitializeComponent();
+        }
+
+        private void InitializeComponent()
+        {
+            PerspexXamlLoader.Load(this);
+        }
+    }
+}

+ 3 - 0
src/Perspex.Themes.Default/RadioButton.xaml

@@ -37,4 +37,7 @@
   <Style Selector="RadioButton:checked /template/ Ellipse#checkMark">
     <Setter Property="IsVisible" Value="True"/>
   </Style>
+  <Style Selector="RadioButton:disabled /template/ Ellipse#border">
+    <Setter Property="Opacity" Value="{StyleResource ThemeDisabledOpacity}"/>
+  </Style>
 </Styles>