-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
74 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.Windows; | ||
|
||
namespace EleCho.WpfSuite | ||
{ | ||
public class GroupBox : System.Windows.Controls.GroupBox | ||
{ | ||
static GroupBox() | ||
{ | ||
DefaultStyleKeyProperty.OverrideMetadata(typeof(GroupBox), new FrameworkPropertyMetadata(typeof(GroupBox))); | ||
} | ||
|
||
|
||
public CornerRadius CornerRadius | ||
{ | ||
get { return (CornerRadius)GetValue(CornerRadiusProperty); } | ||
set { SetValue(CornerRadiusProperty, value); } | ||
} | ||
|
||
|
||
public static readonly DependencyProperty CornerRadiusProperty = | ||
Border.CornerRadiusProperty.AddOwner(typeof(GroupBox), new FrameworkPropertyMetadata(new CornerRadius(3))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:ws="https://github.com/OrgEleCho/EleCho.WpfSuite"> | ||
<BorderGapMaskConverter x:Key="BorderGapMaskConverter"/> | ||
<Style TargetType="{x:Type ws:GroupBox}"> | ||
<Setter Property="BorderBrush" Value="#D5DFE5"/> | ||
<Setter Property="BorderThickness" Value="1"/> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="{x:Type ws:GroupBox}"> | ||
<Grid SnapsToDevicePixels="true"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="6"/> | ||
<ColumnDefinition Width="Auto"/> | ||
<ColumnDefinition Width="*"/> | ||
<ColumnDefinition Width="6"/> | ||
</Grid.ColumnDefinitions> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="*"/> | ||
<RowDefinition Height="6"/> | ||
</Grid.RowDefinitions> | ||
<Border Background="{TemplateBinding Background}" BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4" Grid.Column="0" Grid.ColumnSpan="4" Grid.RowSpan="3" Grid.Row="1"/> | ||
<Border BorderBrush="{TemplateBinding BorderBrush}" | ||
BorderThickness="{TemplateBinding BorderThickness}" | ||
CornerRadius="{TemplateBinding CornerRadius}" Grid.ColumnSpan="4" Grid.RowSpan="3" Grid.Row="1"> | ||
<Border.OpacityMask> | ||
<MultiBinding ConverterParameter="7" Converter="{StaticResource BorderGapMaskConverter}"> | ||
<Binding ElementName="Header" Path="ActualWidth"/> | ||
<Binding Path="ActualWidth" RelativeSource="{RelativeSource Mode=Self}"/> | ||
<Binding Path="ActualHeight" RelativeSource="{RelativeSource Mode=Self}"/> | ||
</MultiBinding> | ||
</Border.OpacityMask> | ||
</Border> | ||
<Border x:Name="Header" Grid.Column="1" Padding="3,1,3,0" Grid.RowSpan="2" Grid.Row="0"> | ||
<ContentPresenter ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> | ||
</Border> | ||
<ContentPresenter Grid.Column="1" Grid.ColumnSpan="2" Margin="{TemplateBinding Padding}" Grid.Row="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> | ||
</Grid> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
</ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters