原文:WPF GroupBox 样式分享

默认样式

GroupBox 样式分享" title="WPF GroupBox 样式分享">

添加样式后



GroupBox 样式分享" title="WPF GroupBox 样式分享">

样式代码:

<Style TargetType="{x:Type
GroupBox}">

           
<Setter Property="BorderBrush"
Value="#D5DFE5"/>

           
<Setter Property="BorderThickness"
Value="1"/>

           
<Setter Property="Template">

               
<Setter.Value>

                   
<ControlTemplate TargetType="{x:Type
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"
MinHeight="59"/>

                               
<RowDefinition Height="*"/>

                               
<RowDefinition Height="6"/>

                           
</Grid.RowDefinitions>

                           
<Border BorderBrush="Transparent"
BorderThickness="{TemplateBinding BorderThickness}"
Grid.ColumnSpan="4" Grid.Column="0" CornerRadius="4" Grid.Row="0"
Grid.RowSpan="4" Background="#FFE5E5E5"
Margin="0,-0.25,0,0.25">

                               
<Border.Effect>

                                   
<DropShadowEffect Color="#FFAAAAAA"
Direction="350"/>

                               
</Border.Effect>

                           
</Border>

                           
<Border x:Name="Header" Grid.Column="1"
Padding="3,1,3,0" Grid.Row="1" Grid.RowSpan="1"
HorizontalAlignment="Right" Background="{x:Null}" Margin="0"
Height="16.96" VerticalAlignment="Top"/>

                           
<ContentPresenter Grid.ColumnSpan="2"
Grid.Column="1" Margin="{TemplateBinding Padding}" Grid.Row="2"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
Grid.RowSpan="1"/>

                           
<Border BorderBrush="White"
BorderThickness="{TemplateBinding BorderThickness}"
Grid.ColumnSpan="4" CornerRadius="4" Grid.Row="1"
Grid.RowSpan="3">

                               
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="3">

                                   
<Border BorderBrush="White"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="2"/>

                               
</Border>

                           
</Border>

                           
<Grid x:Name="HeaderGrid" Height="47.2"
VerticalAlignment="Stretch" Grid.Column="2" Grid.ColumnSpan="2"
Grid.RowSpan="1" Margin="0,7.982,-16,3.818" Grid.Row="1"
HorizontalAlignment="Right">

                               
<Path Data="M12.19,0 L12.290733,14.847
-1.3000648E-08,14.847 z" Height="16.1" Margin="0,0,8.067,0"
RenderTransformOrigin="0.499999978361064,0.499999995889058"
Stretch="Fill" Stroke="Black" StrokeThickness="0"
VerticalAlignment="Top" HorizontalAlignment="Right" Width="12.29"
>

                                   
<Path.Fill>

                                       
<LinearGradientBrush EndPoint="0.466,2.201"
StartPoint="0.5,0">

                                           
<GradientStop Color="#C66A6A6A"
Offset="1"/>

                                           
<GradientStop Color="#E1434343"
Offset="0.855"/>

                                           
<GradientStop Color="#FFC6C6C6"
Offset="0.11"/>

                                       
</LinearGradientBrush>

                                   
</Path.Fill>

                                   
<Path.RenderTransform>

                                       
<TransformGroup>

                                           
<ScaleTransform/>

                                           
<SkewTransform/>

                                           
<RotateTransform
Angle="90.087"/>

                                           
<TranslateTransform Y="-6.04399277075815"
X="6.0531771644038841"/>

                                       
</TransformGroup>

                                   
</Path.RenderTransform>

                               
</Path>

                               
<Border BorderBrush="Black" BorderThickness="0"
Margin="0,8.061,0,0" CornerRadius="16,0,0,16"
Background="White">

                                   
<Border.Effect>

                                       
<DropShadowEffect Direction="195" BlurRadius="10"
Opacity="0.305" ShadowDepth="6"/>

                                   
</Border.Effect>

                                   
<Border x:Name="contentBorder" BorderBrush="Black"
Margin="6,6,0,6" CornerRadius="16,0,0,16">

                                       
<Border.Background>

                                           
<LinearGradientBrush EndPoint="1.002,0.498"
StartPoint="-0.024,0.502">

                                               
<GradientStop Color="#FF678B03"
Offset="0.027"/>

                                               
<GradientStop Color="#FFA4C43D"
Offset="0.948"/>

                                               
<GradientStop Color="#FFADCA54"
Offset="0.969"/>

                                               
<GradientStop Color="#FFA7C646"
Offset="0.975"/>

                                               
<GradientStop Color="#FFC9EF4C"
Offset="0.994"/>

                                           
</LinearGradientBrush>

                                       
</Border.Background>

                                       
<Grid>

                                           
<ContentControl HorizontalAlignment="Left"
Margin="20,0,23,0" VerticalAlignment="Center"
Foreground="White">

                                               
<ContentPresenter ContentSource="Header"
RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding
SnapsToDevicePixels}" HorizontalAlignment="Stretch"
VerticalAlignment="Center" Margin="0"
Width="212.323"/>

                                           
</ContentControl>

                                       
</Grid>

                                   
</Border>

                               
</Border>

                           
</Grid>

                       
</Grid>

                   
</ControlTemplate>

               
</Setter.Value>

           
</Setter>

       
</Style>

前台布局:

<Grid
x:Name="bootGrid">

       
<GroupBox Header="groupBox1" 
x:Name="groupBox1" Margin="100" MinHeight="200"
MinWidth="200">

           
<Grid>

               
<Grid.ColumnDefinitions>

                   
<ColumnDefinition Width="75"/>

                   
<ColumnDefinition Width="10"/>

                   
<ColumnDefinition
Width="150*"/>

               
</Grid.ColumnDefinitions>

               
<Grid.RowDefinitions>

                   
<RowDefinition Height="28"/>

                   
<RowDefinition Height="28"/>

                   
<RowDefinition Height="28"/>

                   
<RowDefinition/>

               
</Grid.RowDefinitions>

               
<TextBlock HorizontalAlignment="Right"
TextWrapping="Wrap" Text="Name:"
VerticalAlignment="Center"/>

               
<TextBlock HorizontalAlignment="Right"
TextWrapping="Wrap" Text="Phone:" VerticalAlignment="Center"
Margin="0" Grid.Row="1"/>

               
<TextBlock HorizontalAlignment="Right"
TextWrapping="Wrap" Text="Email:" VerticalAlignment="Center"
Margin="0" Grid.Row="2"/>

               
<TextBlock HorizontalAlignment="Right"
TextWrapping="Wrap" Text="Address:" VerticalAlignment="Top"
Margin="0 10 0 0" Grid.Row="3"/>

<TextBox Margin="0,0,18.241,0" TextWrapping="Wrap"
VerticalAlignment="Center" Grid.Column="2"
Height="24"/>

               
<TextBox Margin="0,0,18.241,0" TextWrapping="Wrap"
VerticalAlignment="Center" Grid.Column="2" Height="24"
Grid.Row="1"/>

               
<TextBox Margin="0,0,18.241,0" TextWrapping="Wrap"
VerticalAlignment="Center" Grid.Column="2" Height="24"
Grid.Row="2"/>

               
<TextBox Margin="0,2,18.241,20" TextWrapping="Wrap"
VerticalAlignment="Stretch"  Grid.Column="2"
MinHeight="58" Grid.Row="3"/>

           
</Grid>

       
</GroupBox>

   
</Grid>

WPF GroupBox 样式分享的更多相关文章

  1. WPF DataGrid 样式分享

    原文:WPF DataGrid 样式分享 隔行换色,鼠标单击,悬浮样式都有 先看效果: 代码: <DataGrid AutoGenerateColumns="False" N ...

  2. WPF GroupBox样式

    来源:http://code.msdn.microsoft.com/WPF-GroupBox-Style-1d9df7c5/ 效果: XAML CODE: <Window xmlns=" ...

  3. WPF DataGrid 样式设置

    隔行换色,鼠标单击,悬浮样式都有,其具体效果如图 1 所示. 图 1 WPF DataGrid 样式设置效果图 其中: 界面设计代码下所示 ? + 查看代码 1 2 3 4 5 6 7 8 9 10 ...

  4. wpf 导出Excel Wpf Button 样式 wpf简单进度条 List泛型集合对象排序 C#集合

    wpf 导出Excel   1 private void Button_Click_1(object sender, RoutedEventArgs e) 2 { 3 4 ExportDataGrid ...

  5. 求助 WPF ListViewItem样式问题

    求助 WPF ListViewItem样式问题 .NET 开发 > Windows Presentation Foundation Вопрос 0 Нужно войти <Style ...

  6. 自定义WPF 窗口样式

    原文:自定义WPF 窗口样式 Normal 0 false 7.8 pt 0 2 false false false EN-US ZH-CN X-NONE 自定义 Window 在客户端程序中,经常需 ...

  7. WPF中样式和行为和触发器

    原文:WPF中样式和行为和触发器 样式简介:样式(style)是组织和重用格式化选项的重要工具,不是使用重复的标记填充XAML,以便设置外边距.内边距.颜色以及字体等细节.而是创建一系列封装所有这些细 ...

  8. WPF自定义样式篇-DataGrid

    WPF自定义样式篇-DataGrid 先上效果图: 样式:  <!--DataGrid样式-->    <Style TargetType="DataGrid"& ...

  9. WPF CheckBox样式 ScrollViewer样式 WrapPanel、StackPanel、Grid布局

    本节讲述布局,顺带加点样式给大家看看~单纯学布局,肯定是枯燥的~哈哈 那如上界面,该如何设计呢? 1.一些布局元素经常用到.Grid StackPanel Canvas WrapPanel等.如上这种 ...

随机推荐

  1. visual studio 2008安装报错问题处理

    今天刚入职,安装visual studio 2008时报错说web创建组件安装错误,后来发现是因为之前这电脑安装visual studio 2008的时候是office2007刚安装的版本,可是后来系 ...

  2. usb开发笔记

    U盘应属于海量存储类. USB海量存储设备,又包括通用海量存储子类,CDROM,Tape等,U盘实际上属于海量存储类中通用海量存储子类.通用海量存储设备实现上是基于块/扇区存储的设备. USB组织定义 ...

  3. usb mass storage之旅

    前面总结了usb hid keyboard,现在总结usb mass storage,在枚举阶段没什么好总结的,hid和mass storage差不多,都是同样的枚举过程,但是在他们的配置描述符.接口 ...

  4. Qt学习(四)—实例涂鸦画板mspaint

    一.Qt图形绘制 自己在Qt开源社区在自学yafeilinux前辈的<Qt快速入门系列教程>中的图形篇,结合所学的知识,可以做一个涂鸦板实例 二.实现涂鸦板 1.新建工程mspaint, ...

  5. C# 伪造 referer 提交数据

    private string SendRequest(string account, string cardNumber, string cardPass) { string targetUrl = ...

  6. form-validation-engine中的正则表达式

    form-validation-engine是一个不错的表单验证,可以玩玩. (function($) { $.fn.validationEngineLanguage = function() {}; ...

  7. android系统的图片资源

    使用系统的图片资源的好处有,一个是美工不需要重复的做一份已有的图片了,可以节约不少工时:另一个是能保证我们的应用程序的风格与系统一致. 1.引用方式 在源代码*.Java中可以进入如下方式引用: my ...

  8. Android技术路线图

    邮件问题: 老师你好,我从去年就在看你的关于Android的视频了,的确讲的不错,去年看了一段时间,寒假的时候回家重新复习了一下Java基础知识,开学的时候看到你又陆续出了一些视频,这段时间看完了,跟 ...

  9. Impala 1、Impala理论

    1.Impala简介 • Cloudera公司推出,提供对HDFS.Hbase数据的高性能.低延迟的交互式SQL查询功能. • 基于Hive使用内存计算,兼顾数据仓库.具有实时.批处理.多并发等优点 ...

  10. Zookeeper 5、Zookeeper应用场景

    应用场景1 .统一命名服务 » 分布式应用中,通常需要有一套完整的命名规则,既能够产生唯一的名称又便于人识别和记住,通常情况 下用树形的名称结构是一个理想的选择,树形的名称结构是一个有层次的目录结构, ...