<Page x:Class="Lx.Pages.Page_bkzj_gn"
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:Lx.Pages"
xmlns:c="clr-namespace:Lx.Converters"
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
Title="Page_bkzj_gn">
<Page.Resources>
<c:NumConverter x:Key="NumConverter"/>
<c:MyColorConverter x:Key="colorConverter"/>
<Style TargetType="RadioButton">
<Setter Property="Margin" Value="5"></Setter>
<Setter Property="Command" Value="{Binding CheckChangedCommand}" ></Setter>
<Setter Property="CommandParameter" Value="{Binding RelativeSource={RelativeSource Mode=Self}}"/>
</Style>
<!-- DataGridTextColumn 文字居中 -->
<Style x:Key="CenterAlignmentStyle" TargetType="TextBlock">
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<!--CollectionViewSource-->
<CollectionViewSource x:Key="cvsTasks" Source="{Binding Path=DataList}" >
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="f62" Direction="Descending"/>
<scm:SortDescription PropertyName="f3" Direction="Descending"/>
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
<!--<Style TargetType="DataGridCell">
<Setter Property="Foreground"
Value="{Binding Path=Item.PropertyPath, RelativeSource={RelativeSource Mode=Self},Converter={StaticResource colorConverter}}"/>
</Style>-->
</Page.Resources>
<DockPanel>
<StackPanel Orientation="Horizontal" DockPanel.Dock="Top" >
<RadioButton x:Name="rad1" IsChecked="True" >今日</RadioButton>
<RadioButton x:Name="rad2" IsChecked="False">5日</RadioButton>
<RadioButton x:Name="rad3" IsChecked="False">10日</RadioButton>
</StackPanel>
<DataGrid ItemsSource="{Binding Source={StaticResource cvsTasks}}" CanUserAddRows="False" AutoGenerateColumns="False">
<DataGrid.Columns >
<DataGridTextColumn Header="名称" Binding="{Binding f14}" ElementStyle="{StaticResource CenterAlignmentStyle}"/>
<DataGridTextColumn ElementStyle="{StaticResource CenterAlignmentStyle}"
Header="今日跌涨幅"
Binding="{Binding f3, Converter={StaticResource NumConverter},
ConverterParameter=100, StringFormat={}{0:P2}}" >
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Foreground" Value="{Binding f3, Converter={StaticResource colorConverter}}"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTextColumn ElementStyle="{StaticResource CenterAlignmentStyle}"
Header="今日主力净流入" Binding="{Binding f62, Converter={StaticResource NumConverter},
ConverterParameter=100000000, StringFormat={}{0:0.00}亿}" >
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Foreground" Value="{Binding f62, Converter={StaticResource colorConverter}}"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTextColumn ElementStyle="{StaticResource CenterAlignmentStyle}"
Header="净占比" Binding="{Binding f184, Converter={StaticResource NumConverter},
ConverterParameter=100, StringFormat={}{0:P2}}" >
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Foreground" Value="{Binding f184, Converter={StaticResource colorConverter}}"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTextColumn ElementStyle="{StaticResource CenterAlignmentStyle}"
Header="今日超大单流入" Binding="{Binding f66, Converter={StaticResource NumConverter},
ConverterParameter=100000000, StringFormat={}{0:0.00}亿}" >
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Foreground" Value="{Binding f66, Converter={StaticResource colorConverter}}"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTextColumn ElementStyle="{StaticResource CenterAlignmentStyle}"
Header="净占比"
Binding="{Binding f69, Converter={StaticResource NumConverter},
ConverterParameter=100, StringFormat={}{0:P2}}" >
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Foreground" Value="{Binding f69, Converter={StaticResource colorConverter}}"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTextColumn ElementStyle="{StaticResource CenterAlignmentStyle}"
Header="今日大单净流入"
Binding="{Binding f72, Converter={StaticResource NumConverter},
ConverterParameter=100000000, StringFormat={}{0:0.00}亿}" >
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Foreground" Value="{Binding f72, Converter={StaticResource colorConverter}}"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTextColumn ElementStyle="{StaticResource CenterAlignmentStyle}"
Header="净占比"
Binding="{Binding f75, Converter={StaticResource NumConverter},
ConverterParameter=100, StringFormat={}{0:P2}}" >
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Foreground" Value="{Binding f75, Converter={StaticResource colorConverter}}"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTextColumn ElementStyle="{StaticResource CenterAlignmentStyle}"
Header="今日中单净流入"
Binding="{Binding f78, Converter={StaticResource NumConverter},
ConverterParameter=100000000, StringFormat={}{0:0.00}亿}" >
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Foreground" Value="{Binding f78, Converter={StaticResource colorConverter}}"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTextColumn ElementStyle="{StaticResource CenterAlignmentStyle}"
Header="净占比"
Binding="{Binding f81, Converter={StaticResource NumConverter},
ConverterParameter=100, StringFormat={}{0:P2}}" >
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Foreground" Value="{Binding f81, Converter={StaticResource colorConverter}}"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTextColumn ElementStyle="{StaticResource CenterAlignmentStyle}"
Header="今日小单净流入"
Binding="{Binding f84, Converter={StaticResource NumConverter},
ConverterParameter=100000000, StringFormat={}{0:0.00}亿}" >
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Foreground" Value="{Binding f84, Converter={StaticResource colorConverter}}"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
<DataGridTextColumn ElementStyle="{StaticResource CenterAlignmentStyle}"
Header="净占比"
Binding="{Binding f87, Converter={StaticResource NumConverter},ConverterParameter=100, StringFormat={}{0:P2}}" >
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Foreground" Value="{Binding f87, Converter={StaticResource colorConverter}}"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</DockPanel>
</Page>
Datagrid布局与样式(居中,单元格颜色,排序)
最新推荐文章于 2024-06-02 21:10:08 发布