自定义的一个表头

 <bp:BasePage x:Class="NetReform.Pages.RealProbabiTableCompare"
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:local="clr-namespace:NetReform"
xmlns:bp="clr-namespace:NetReform.Pages"
mc:Ignorable="d"
xmlns:my="clr-namespace:WpfControls;assembly=WpfControls"
Title="RealProbabiTableCompare" >
<Grid > <Grid.Resources> <!--背景色改变必须先设置cellStyle 因为cellStyle会覆盖rowStyle样式-->
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="#F2F2F2" />
<Setter Property="Height" Value=""/>
<Setter Property="Foreground" Value="Black" />
<Style.Triggers>
<!--隔行换色-->
<Trigger Property="AlternationIndex" Value="" >
<Setter Property="Background" Value="#e7e7e7" />
</Trigger>
<Trigger Property="AlternationIndex" Value="" >
<Setter Property="Background" Value="#f2f2f2" />
</Trigger> <Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="LightGray"/>
<!--<Setter Property="Foreground" Value="White"/>-->
</Trigger> <Trigger Property="IsSelected" Value="True">
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
<!--原来的样式-->
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="FontFamily" Value="Arial" />
<Setter Property="FontSize" Value="" />
<Setter Property="Foreground" Value="#FFFAF0" />
</Style> <Style x:Key="br_bgGray" TargetType="Border">
<Setter Property="Background" Value="#dbdbdb"/>
</Style> <Style TargetType="Grid" x:Key="MyDataGrid">
<Setter Property="Background" >
<Setter.Value>
<!--垂直渐变-->
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#555555" Offset="0.0"/>
<GradientStop Color="#111111" Offset="0.5"/>
<GradientStop Color="#555555" Offset="1.0"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" >
<Setter.Value>
<!--垂直渐变-->
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FF111111" Offset="0.0"/>
<GradientStop Color="#FF333333" Offset="1.0"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style> </Grid.Resources> <Grid.RowDefinitions>
<RowDefinition Height="" />
<RowDefinition Height="" />
<RowDefinition Height=""/>
<RowDefinition Height="*"/>
<RowDefinition Height=""/>
</Grid.RowDefinitions> <!--第一行--> <Label Content="概率预报对比" FontSize="" Foreground="White" Grid.Row="" Background="Gray"></Label> <!--第三行放表格头-->
<Grid Margin="10,10,10,0" Grid.Row="" Panel.ZIndex="" Style="{StaticResource MyDataGrid}" >
<Grid.RowDefinitions>
<RowDefinition Height="4*" />
<RowDefinition Height="66*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="8*"/>
<ColumnDefinition Width="16*"/>
<ColumnDefinition Width="13*"/>
<ColumnDefinition Width="18*"/>
<ColumnDefinition Width="16*"/>
<ColumnDefinition Width=""/>
</Grid.ColumnDefinitions>
<Border BorderThickness="" BorderBrush="Gray" CornerRadius="" Grid.RowSpan="">
<TextBlock HorizontalAlignment="Center" >ID</TextBlock>
</Border>
<Border Grid.Column="" BorderThickness="" BorderBrush="Gray" CornerRadius="" Grid.RowSpan="">
<TextBlock HorizontalAlignment="Center" >Date</TextBlock>
</Border> <Border Grid.Column="" Grid.ColumnSpan="" BorderThickness="" BorderBrush="Gray" CornerRadius="" Grid.RowSpan="">
<Grid >
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border Grid.Row="" Grid.ColumnSpan="" BorderThickness="" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.ColumnSpan="">太阳耀斑概率</TextBlock>
</Border>
<Border Grid.Row="" Grid.Column="" BorderThickness="0,1,1,0" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.Column="">obs</TextBlock>
</Border>
<Border Grid.Row="" Grid.Column="" BorderThickness="0,1,0,0" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.Column="">1d(%)</TextBlock>
</Border>
<Border Grid.Row="" Grid.Column="" BorderThickness="1,1,0,0" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.Column="">2d(%)</TextBlock>
</Border>
<Border Grid.Row="" Grid.Column="" BorderThickness="1,1,0,0" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.Column="">3d(%)</TextBlock>
</Border>
</Grid>
</Border> <Border Grid.Column="" Grid.ColumnSpan="" BorderThickness="" BorderBrush="Gray" CornerRadius="" Grid.RowSpan="">
<Grid >
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="3*"/>
</Grid.ColumnDefinitions>
<Border Grid.Row="" Grid.ColumnSpan="" BorderThickness="" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.ColumnSpan="">质子事件概率</TextBlock>
</Border>
<Border Grid.Row="" Grid.Column="" BorderThickness="0,1,1,0" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.Column="">obs</TextBlock>
</Border>
<Border Grid.Row="" Grid.Column="" BorderThickness="0,1,0,0" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.Column="">1d(%)</TextBlock>
</Border>
<Border Grid.Row="" Grid.Column="" BorderThickness="1,1,0,0" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.Column="">2d(%)</TextBlock>
</Border>
<Border Grid.Row="" Grid.Column="" BorderThickness="1,1,0,0" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.Column="">3d(%)</TextBlock>
</Border>
</Grid>
</Border> <Border Grid.Column="" Grid.ColumnSpan="" BorderThickness="" BorderBrush="Gray" CornerRadius="" Grid.RowSpan="">
<Grid >
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="9*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="3*"/>
</Grid.ColumnDefinitions>
<Border Grid.Row="" Grid.ColumnSpan="" BorderThickness="" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.ColumnSpan="">地磁暴概率</TextBlock>
</Border>
<Border Grid.Row="" Grid.Column="" BorderThickness="0,1,1,0" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.Column="">obs</TextBlock>
</Border>
<Border Grid.Row="" Grid.Column="" BorderThickness="0,1,0,0" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.Column="">1d(%)</TextBlock>
</Border>
<Border Grid.Row="" Grid.Column="" BorderThickness="1,1,0,0" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.Column="">2d(%)</TextBlock>
</Border>
<Border Grid.Row="" Grid.Column="" BorderThickness="1,1,0,0" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.Column="">3d(%)</TextBlock>
</Border>
</Grid>
</Border> <Border Grid.Column="" Grid.ColumnSpan="" BorderThickness="" BorderBrush="Gray" CornerRadius="" Grid.RowSpan="">
<Grid >
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border Grid.Row="" Grid.ColumnSpan="" BorderThickness="" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.ColumnSpan="">高能电子暴概率</TextBlock>
</Border>
<Border Grid.Row="" Grid.Column="" BorderThickness="0,1,1,0" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.Column="">obs</TextBlock>
</Border>
<Border Grid.Row="" Grid.Column="" BorderThickness="0,1,0,0" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.Column="">1d(%)</TextBlock>
</Border>
<Border Grid.Row="" Grid.Column="" BorderThickness="1,1,0,0" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.Column="">2d(%)</TextBlock>
</Border>
<Border Grid.Row="" Grid.Column="" BorderThickness="1,1,0,0" BorderBrush="Gray" CornerRadius="">
<TextBlock Grid.Row="" Grid.Column="">3d(%)</TextBlock>
</Border>
</Grid>
</Border> </Grid> <!--第四行放数据--> <DataGrid Grid.Row="" Background="LightGray" Name="dg1" Margin="10,-27,10,0" Grid.Column="" Grid.RowSpan="" ItemsSource="{Binding}" AutoGenerateColumns="False" CanUserAddRows="False" HorizontalScrollBarVisibility="Disabled" AlternationCount="" AreRowDetailsFrozen="True" RowHeaderWidth="" HeadersVisibility="Column" IsReadOnly="True" HorizontalGridLinesBrush="LightGray" VerticalGridLinesBrush="LightGray" Foreground="#FF9C9D9D" BorderBrush="Black" VerticalScrollBarVisibility="Visible"> <DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Height" Value="" />
<Setter Property="Foreground" Value="Black" />
<!--datagrid 垂直居中、水平左对齐 -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<!--datagrid 设置选中行的背景色 -->
<Style.Triggers >
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#00B0C4DE"></Setter>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<!--ID列-->
<DataGridTemplateColumn Header="ID" Width="4*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate >
<Border Height="" Width="">
<TextBlock Foreground="Gray" FontSize="" Height="" FontFamily="Microsoft YaHei" HorizontalAlignment="Left" Margin="9,5,0,0" Background="Transparent" Text="{Binding ID}"/>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--时间列-->
<DataGridTextColumn Header="Date" FontSize="" Binding="{Binding dayTime}" Width="8*" Foreground="Gray" FontFamily="Microsoft YaHei">
</DataGridTextColumn> <!--<DataGridTextColumn Header="CNum" FontSize="" Binding="{Binding value}" Width="4*" Foreground="Gray" FontFamily="Microsoft YaHei"> </DataGridTextColumn>-->
<DataGridTemplateColumn Header="obs" Width="4*" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate >
<Border Height="" Width="" Style="{StaticResource ResourceKey=br_bgGray}">
<TextBlock Foreground="Gray" FontSize="" Height="" FontFamily="Microsoft YaHei" HorizontalAlignment="Left" Margin="9,5,0,0" Background="Transparent" Text="{Binding value}"/>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="1d" FontSize="" Binding="{Binding pre1}" Width="4*" Foreground="Gray" FontFamily="Microsoft YaHei">
</DataGridTextColumn>
<DataGridTextColumn Header="2d" FontSize="" Binding="{Binding pre2}" Width="4*" Foreground="Gray" FontFamily="Microsoft YaHei">
</DataGridTextColumn>
<DataGridTextColumn Header="3d" FontSize="" Binding="{Binding pre3}" Width="4*" Foreground="Gray" FontFamily="Microsoft YaHei">
</DataGridTextColumn> <!--kp列要更改的位置就是这里-->
<!--<DataGridTextColumn Header="CNum" FontSize="" Binding="{Binding valueu}" Width="4*" Foreground="Gray" FontFamily="Microsoft YaHei">
</DataGridTextColumn>--> <DataGridTemplateColumn Header="obs" Width="4*" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate >
<Border Height="" Width="" Style="{StaticResource ResourceKey=br_bgGray}">
<TextBlock Foreground="Gray" FontSize="" Height="" FontFamily="Microsoft YaHei" HorizontalAlignment="Left" Margin="9,5,0,0" Background="Transparent" Text="{Binding valueu}"/>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="1d" FontSize="" Binding="{Binding pre1u}" Width="3*" Foreground="Gray" FontFamily="Microsoft YaHei">
</DataGridTextColumn>
<DataGridTextColumn Header="2d" FontSize="" Binding="{Binding pre2u}" Width="3*" Foreground="Gray" FontFamily="Microsoft YaHei">
</DataGridTextColumn>
<DataGridTextColumn Header="3d" FontSize="" Binding="{Binding pre3u}" Width="3*" Foreground="Gray" FontFamily="Microsoft YaHei">
</DataGridTextColumn> <!--<DataGridTextColumn Header="CNum" FontSize="" Binding="{Binding valuem}" Width="7*" Foreground="Gray" FontFamily="Microsoft YaHei">
</DataGridTextColumn>-->
<DataGridTemplateColumn Header="obs" Width="9*" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate >
<Border Height="" Width="" Style="{StaticResource ResourceKey=br_bgGray}">
<TextBlock Foreground="Gray" FontSize="" Height="" FontFamily="Microsoft YaHei" HorizontalAlignment="Left" Margin="9,5,0,0" Background="Transparent" Text="{Binding valuem}"/>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> <DataGridTextColumn Header="1d" FontSize="" Binding="{Binding pre1m}" Width="3*" Foreground="Gray" FontFamily="Microsoft YaHei">
</DataGridTextColumn>
<DataGridTextColumn Header="2d" FontSize="" Binding="{Binding pre2m}" Width="3*" Foreground="Gray" FontFamily="Microsoft YaHei">
</DataGridTextColumn>
<DataGridTextColumn Header="3d" FontSize="" Binding="{Binding pre3m}" Width="3*" Foreground="Gray" FontFamily="Microsoft YaHei">
</DataGridTextColumn> <!--<DataGridTextColumn Header="CNum" FontSize="" Binding="{Binding valuec}" Width="4*" Foreground="Gray" FontFamily="Microsoft YaHei">
</DataGridTextColumn>-->
<DataGridTemplateColumn Header="obs" Width="4*" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate >
<Border Height="" Width="" Style="{StaticResource ResourceKey=br_bgGray}">
<TextBlock Foreground="Gray" FontSize="" Height="" FontFamily="Microsoft YaHei" HorizontalAlignment="Left" Margin="9,5,0,0" Background="Transparent" Text="{Binding valuec}"/>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> <DataGridTextColumn Header="1d" FontSize="" Binding="{Binding pre1c}" Width="4*" Foreground="Gray" FontFamily="Microsoft YaHei">
</DataGridTextColumn>
<DataGridTextColumn Header="2d" FontSize="" Binding="{Binding pre2c}" Width="4*" Foreground="Gray" FontFamily="Microsoft YaHei">
</DataGridTextColumn>
<DataGridTextColumn Header="3d" FontSize="" Binding="{Binding pre3c}" Width="4*" Foreground="Gray" FontFamily="Microsoft YaHei">
</DataGridTextColumn> </DataGrid.Columns>
</DataGrid> <!--第五行放数据处理后的值-->
<StackPanel Grid.Row="" Orientation="Horizontal" HorizontalAlignment="Center">
<Label Content="From:" HorizontalContentAlignment="Right" Style="{StaticResource QueryLabel}"></Label>
<DatePicker Width="" Height="" x:Name="Dp_Start" BorderThickness="" HorizontalAlignment="Center" VerticalContentAlignment="Center" /> <Label Content="To:" HorizontalContentAlignment="Right" Style="{StaticResource QueryLabel}"></Label>
<DatePicker Width="" Height="" x:Name="Dp_End" BorderThickness="" HorizontalAlignment="Center" VerticalContentAlignment="Center" />
<Button Name="Bt_CheckCurr" Style="{StaticResource Button_Image}" Width="" Height="" HorizontalAlignment="Left" ToolTip="查询" >
<Image Source="/NetReform;component/Images/Search.png" Width="" Height="" />
</Button>
</StackPanel>
</Grid>
</bp:BasePage>

自定义表头Datagrid的更多相关文章

  1. WPF DataGrid 复合表头 (实现表头合并,自定义表头)

    功能说明: 将 DataGrid嵌套在本控件内,使用Label自定义表头,如果需要上下左右滚动 需要在控件外围添加  ScrollViewer 并且设置  ScrollVisibility 为Auto ...

  2. QTableWidget自定义表头QHeaderView加全选复选框

    1         QTableWidget自定义表头QHeaderView加全选复选框 在使用QTableWidget时需要在表头添加全选复选框,但是默认的表头无法添加复选框,只能用图片画上去一个复 ...

  3. vue + element ui 表格自定义表头,提供线上demo

    前言:工作中用到 vue+element ui 的前端框架,需要使用自定义表头,需要使用 re.转载请注明出处:https://www.cnblogs.com/yuxiaole/p/9710826.h ...

  4. ElementUI2.0组件库el-table表格组件如何自定义表头?

    效果图: npm run dev 编译项目之后,报错,要使用jsx语法需要先安装编译插件 1.安装下列安装包 npm install babel-plugin-syntax-jsx --save-de ...

  5. element之table自定义表头

    1.实现效果 2.使用render-header可以自定义表头 <el-table-column prop="date" label="日期" sorta ...

  6. ElementUI的Table-column_render-header自定义表头

    ElementUI的Table表格,官方网站上提供了很多样式,但是在日常开发中还会碰到各种情况,显然官方提供的是不能满足需求的.那么,我们就根据自己的需求对table进行改造. 先丢出关于Table的 ...

  7. gridview自定义表头

    gridview为我们提供了丰富的接口,用于满足自定义需求. 通常asp:gridview会根据绑定的列Columns自动生成表头,展现在前台元素. 序号 类别 有时候需要复杂一些的表头. 序号 类别 ...

  8. [Qt]自定义表头实现过滤功能

    1. 写在前面 过滤功能源自项目上交互优化用户体验,在表头添加过滤符号实现过滤,替换以往在表格上方占用一行过滤项进行过滤. 2. 过滤提示 过滤提示就是三态图标(normal,hover,press) ...

  9. element ui table render-header自定义表头信息使用

    在使用vue自定义组件内容过程之中,我们绝大多数情况下都是通过预先写好不同的html模板,再通过props传入不同的值来渲染不同的模板.例如我们需要实现一个<v-title size='1'&g ...

随机推荐

  1. null,undefined,undeclared的区别

    1.null表示"没有对象",即该处不应该有值,转为数值时为0.典型用法是: (1) 作为函数的参数,表示该函数的参数不是对象. (2) 作为对象原型链的终点. 2.undefin ...

  2. select 源码分析

    ## select(2),同步的 I/O 复用 直接看 epoll 的源码把自己绕晕了,先整个简单点的下手. - [使用](#usage) - [源码分析](#src_analysis) ### se ...

  3. 文章导航-readme

    Spring-Boot Spring Boot(一) Hello World Redis 图解Redis之数据结构篇--简单动态字符串SDS 图解Redis之数据结构篇--链表 图解Redis之数据结 ...

  4. openssl req(生成证书请求和自建CA)(转)

    openssl req(生成证书请求和自建CA)     伪命令req大致有3个功能:生成证书请求文件.验证证书请求文件和创建根CA.由于openssl req命令选项较多,所以先各举几个例子,再集中 ...

  5. jQuery常用方法(一)-基础

    $("p").addClass(css中定义的样式类型); 给某个元素添加样式 $("img").attr({src:"test.jpg", ...

  6. Flume 知识点(六)Flume 的监控

    简述 使用 Flume 实时收集日志的过程中,尽管有事务机制保证数据不丢失,但仍然需要时刻关注 Source.Channel.Sink 之间的消息传输是否正常. 比如,SouceChannel 传输了 ...

  7. Scala 多继承顺序

    Trait多继承顺序: 准则: 如果有超类,则先调用超类的函数. 如果混入的trait有父trait,它会按照继承层次先调用父trait的构造函数. 如果有多个父trait,则按顺序从左到右执行. 所 ...

  8. Mongoose: aggregate聚合 $group使用说明

    aggregate聚合是通过管道操作实现的.聚合管道里的每一步输出,都会作为下一步的输入,每一步在输入文档执行完操作后生成输出文档. 聚合管道:  $project 修改输入文档的结构.可以用来重命名 ...

  9. Java面试----01.JavaSE

    1.面向对象和面向过程的区别 面向过程:面向过程性能比面向对象高. 因为类调用时需要实例化,比较消耗资源,所以当性能是最重要的考虑因素时,比如单片机.嵌入式开发.Linux/Unix等一般采用面向对象 ...

  10. 从xxe-lab来深入学习xxe漏洞

    这几天,想复习一下xxe的知识,于是把以前的一个靶场拿过来玩玩,顺便审计一下代码2333,靶场地址:https://github.com/c0ny1/xxe-lab 首先先练习的是php-xxe: 我 ...