Browse Source

Added RadioButton, ToggleButton XAML styles.

pull/297/head
Steven Kirk 11 years ago
parent
commit
3808372896
  1. 35
      samples/XamlTestApplicationPcl/RadioButton.paml
  2. 38
      samples/XamlTestApplicationPcl/ToggleButton.paml
  3. 2
      samples/XamlTestApplicationPcl/XamlTestApp.paml
  4. 6
      samples/XamlTestApplicationPcl/XamlTestApplicationPcl.csproj

35
samples/XamlTestApplicationPcl/RadioButton.paml

@ -0,0 +1,35 @@
<Styles xmlns="https://github.com/perspex">
<Style Selector="RadioButton">
<Setter Property="BorderBrush" Value="#ff333333"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="Template">
<ControlTemplate>
<Grid ColumnDefinitions="Auto,*">
<Ellipse Stroke="{TemplateBinding BorderBrush}"
StrokeThickness="{TemplateBinding BorderThickness}"
Width="18"
Height="18"
VerticalAlignment="Center"/>
<Ellipse Name="checkMark"
Fill="{TemplateBinding BorderBrush}"
Width="10"
Height="10"
Stretch="Uniform"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<ContentPresenter Name="PART_ContentPresenter"
Content="{TemplateBinding Content}"
Margin="4,0,0,0"
VerticalAlignment="Center"
Grid.Column="1"/>
</Grid>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="RadioButton /template/ Ellipse#checkMark">
<Setter Property="IsVisible" Value="False"/>
</Style>
<Style Selector="RadioButton:checked /template/ Ellipse#checkMark">
<Setter Property="IsVisible" Value="True"/>
</Style>
</Styles>

38
samples/XamlTestApplicationPcl/ToggleButton.paml

@ -0,0 +1,38 @@
<Styles xmlns="https://github.com/perspex">
<Style Selector="ToggleButton">
<Setter Property="Background" Value="#ffaaaaaa"/>
<Setter Property="BorderBrush" Value="#ffaaaaaa"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template">
<ControlTemplate>
<Border Name="border"
Padding="3"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ContentPresenter Content="{TemplateBinding Content}"
Margin="{TemplateBinding Padding}"
TextBlock.Foreground="{TemplateBinding Foreground}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="ToggleButton:checked /template/ Border#border">
<Setter Property="Background" Value="#ff777777"/>
<Setter Property="BorderBrush" Value="#ff777777"/>
</Style>
<Style Selector="ToggleButton:pointerover /template/ Border#border">
<Setter Property="BorderBrush" Value="#ff888888"/>
</Style>
<Style Selector="ToggleButton:pressed /template/ Border#border">
<Setter Property="Background" Value="#ff888888"/>
</Style>
<Style Selector="ToggleButton:disabled">
<Setter Property="Opacity" Value="0.5"/>
</Style>
</Styles>

2
samples/XamlTestApplicationPcl/XamlTestApp.paml

@ -5,12 +5,14 @@
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.Button.paml"/>
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.Carousel.paml"/>
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.CheckBox.paml"/>
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.RadioButton.paml"/>
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.ScrollBar.paml"/>
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.ScrollViewer.paml"/>
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.TabControl.paml"/>
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.TabItem.paml"/>
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.TabStrip.paml"/>
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.TextBox.paml"/>
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.ToggleButton.paml"/>
<StyleInclude Source="resource://application/XamlTestApplicationPcl/XamlTestApplication.Window.paml"/>
</Application.Styles>
</Application>

6
samples/XamlTestApplicationPcl/XamlTestApplicationPcl.csproj

@ -145,6 +145,12 @@
<EmbeddedResource Include="ScrollBar.paml">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="ToggleButton.paml">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="RadioButton.paml">
<SubType>Designer</SubType>
</EmbeddedResource>
<None Include="packages.config" />
<EmbeddedResource Include="Button.paml">
<SubType>Designer</SubType>

Loading…
Cancel
Save