调整wpf的界面显示样式
This commit is contained in:
1 parent
e3027e5fa8
commit
d03a1e1466
5 files changed
+191
-24
No files matched your search
+140
-20
@@ -4,22 +4,59 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:_29WxOrderWpf"
|
||||
mc:Ignorable="d" WindowStyle="None" AllowsTransparency="True" Background="Transparent"
|
||||
mc:Ignorable="d" WindowStyle="None" AllowsTransparency="True" Background="Transparent" FontSize="12" Foreground="#FF666666"
|
||||
Title="MainWindow" Height="450" Width="800" WindowStartupLocation="CenterScreen" Loaded="Window_Loaded">
|
||||
<WindowChrome.WindowChrome>
|
||||
<!--边框可拖动范围-->
|
||||
<WindowChrome CaptionHeight="10" ResizeBorderThickness="5" />
|
||||
</WindowChrome.WindowChrome>
|
||||
|
||||
|
||||
<Grid Background="AliceBlue">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="50"></RowDefinition>
|
||||
<RowDefinition Height="60"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Grid.RowSpan="10" BorderThickness="1" BorderBrush="Blue"></Border>
|
||||
<Border Grid.RowSpan="10" BorderThickness="1" BorderBrush="Blue">
|
||||
<!--<TextBlock x:Name="TextBlock1" Text="1111"></TextBlock>-->
|
||||
</Border>
|
||||
<Grid Width="auto" Height="20">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="4"></ColumnDefinition>
|
||||
<ColumnDefinition Width="20"></ColumnDefinition>
|
||||
<ColumnDefinition Width="4"></ColumnDefinition>
|
||||
<ColumnDefinition Width="20"></ColumnDefinition>
|
||||
<ColumnDefinition Width="4"></ColumnDefinition>
|
||||
<ColumnDefinition Width="20"></ColumnDefinition>
|
||||
<ColumnDefinition Width="4"></ColumnDefinition>
|
||||
<ColumnDefinition Width="20"></ColumnDefinition>
|
||||
<ColumnDefinition Width="4"></ColumnDefinition>
|
||||
<ColumnDefinition Width="20"></ColumnDefinition>
|
||||
<ColumnDefinition Width="4"></ColumnDefinition>
|
||||
<ColumnDefinition Width="20"></ColumnDefinition>
|
||||
<ColumnDefinition Width="4"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!--<Path Grid.Row="0" Grid.Column="1" Stroke="Black" StrokeThickness="1" Data="M0 54.857h36.571V128H0V54.857zM91.429 27.43H128V128H91.429V27.429zM45.714 0h36.572v128H45.714V0z" Stretch="Uniform" />
|
||||
<Path Grid.Row="0" Grid.Column="3" Stroke="Black" StrokeThickness="1" Data="M768 64a128 128 0 0 1 128 128v640a128 128 0 0 1-128 128H256a128 128 0 0 1-128-128V192a128 128 0 0 1 128-128h512z m-96 608h-320a32 32 0 1 0 0 64h320a32 32 0 1 0 0-64z m0-192h-320a32 32 0 0 0 0 64h320a32 32 0 1 0 0-64z m-256-192h-64a32 32 0 0 0 0 64h64a32 32 0 0 0 0-64z m256 0h-128a32 32 0 0 0 0 64h128a32 32 0 1 0 0-64z" Margin="0,0,0,0" Grid.RowSpan="2" Stretch="Fill" />
|
||||
<Path Grid.Row="0" Grid.Column="5" Fill="#0051FF" Stroke="Transparent" StrokeThickness="1" Data="M657.84768 704.32H519.35168l79.808-454.4h138.432z M405.68768 704.32H267.19168l56.96-324.608h138.432z M886.58368 50.432l-12.8 71.424-38.4 218.816-2.368 13.568-3.264 18.368-62.528 356.736a130.688 130.688 0 0 1-123.136 104.704H235.89568a85.696 85.696 0 0 1-86.592-104.512L215.09568 354.56a130.624 130.624 0 0 1 123.072-104.704H484.85568l24.384-139.2H324.66368a256 256 0 0 0-241.28 205.248L4.15168 768.128a168 168 0 0 0 169.152 205.248h484.16a256 256 0 0 0 241.216-205.248l74.944-427.2 4.416-25.024L1025.01568 50.688z" Margin="0,0,0,0" Grid.RowSpan="2" Stretch="Fill" />
|
||||
<Path Grid.Row="0" Grid.Column="7" Fill="#0051FF" Stroke="Transparent" StrokeThickness="1" Data="M539.04256 845.248V512.192a32.448 32.448 0 0 0-32-32.192c-17.664 0-32 14.912-32 32.192v333.056l-36.096-36.096a32.192 32.192 0 0 0-45.056 0.192 31.616 31.616 0 0 0-0.192 45.056l90.88 90.944a31.36 31.36 0 0 0 22.528 9.088 30.08 30.08 0 0 0 22.4-9.088l90.88-90.88a32.192 32.192 0 0 0-0.192-45.12 31.616 31.616 0 0 0-45.056-0.192l-36.096 36.096z M768.35456 416a256 256 0 1 0-512 0 192 192 0 1 0 0 384v64a256 256 0 0 1-58.88-505.216 320.128 320.128 0 0 1 629.76 0A256.128 256.128 0 0 1 768.35456 864v-64a192 192 0 0 0 0-384z m-512 384h64v64H256.35456v-64z m448 0h64v64h-64v-64z" Margin="0,0,0,0" Grid.RowSpan="2" Stretch="Fill" />
|
||||
<Path Grid.Row="0" Grid.Column="9" Fill="#0051FF" Stroke="Transparent" StrokeThickness="1" Data="M73.137 29.08h-9.209 29.7L63.886.093 34.373 29.08h20.49v27.035H27.238v17.948h27.625v27.133h18.274V74.063h27.41V56.115h-27.41V29.08zm-9.245 98.827l27.518-26.711H36.59l27.302 26.71zM.042 64.982l27.196 27.029V38.167L.042 64.982zm100.505-26.815V92.01l27.41-27.029-27.41-26.815z" Margin="0,0,0,0" Grid.RowSpan="2" Stretch="Fill" />-->
|
||||
</Grid>
|
||||
<Button Grid.Row="0" Content="x" HorizontalAlignment="Right" Margin="4" VerticalAlignment="Top" Width="20" Height="20" Click="btnClose_Click"/>
|
||||
<DataGrid Grid.Row="1" HorizontalContentAlignment="Center" Margin="2,0,2,2" RowHeight="60" x:Name="dgOrder" Grid.ColumnSpan="2"
|
||||
HorizontalGridLinesBrush="LightGray" VerticalGridLinesBrush="LightGray" CanUserDeleteRows="False" CanUserAddRows="False">
|
||||
<DataGrid Grid.Row="1" Opacity="0" HorizontalContentAlignment="Center" Margin="2,0,2,2" RowHeight="60" x:Name="dgOrder" Grid.ColumnSpan="2"
|
||||
ItemsSource="{Binding lstOrder}" AutoGenerateColumns = "False" HorizontalGridLinesBrush="LightGray" VerticalGridLinesBrush="LightGray"
|
||||
CanUserDeleteRows="False" CanUserAddRows="False" ColumnHeaderHeight="40">
|
||||
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="Background" Value="White"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="AliceBlue"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.CellStyle>
|
||||
<Style TargetType="DataGridCell">
|
||||
<Setter Property="Background" Value="White"/>
|
||||
@@ -32,21 +69,22 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.CellStyle>
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="Background" Value="White"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="AliceBlue"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
|
||||
<DataGrid.Columns>
|
||||
|
||||
<DataGridCheckBoxColumn Binding="{x:Null}" ClipboardContentBinding="{x:Null}" Width="50"/>
|
||||
<DataGridTemplateColumn ClipboardContentBinding="{x:Null}" Width="*" Header="订单编号"/>
|
||||
<DataGridTemplateColumn Width="*" Header="订单编号" >
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
<RowDefinition Height="auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox Grid.Row="1" HorizontalAlignment="Center" Width="Auto" Height="20" Background="Transparent" IsReadOnly="True" Text="{Binding order_id}" BorderThickness="0"></TextBox>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Width="*" Header="图标">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
@@ -65,9 +103,91 @@
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Margin="4,0" Background="White">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="40"></ColumnDefinition>
|
||||
<ColumnDefinition Width="100*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="50*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="50*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="100*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="50*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="50*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="50*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
</Grid>
|
||||
<ListBox IsHitTestVisible="True" Opacity="1" ItemsSource="{Binding lstOrder}" Grid.Row="1" HorizontalContentAlignment="Stretch" x:Name="lbxOrder" Margin="4,0,4,4">
|
||||
<!--使用自定义属性模板去除ListBox高亮显示框-->
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListBoxItem">
|
||||
<ContentPresenter Content="{TemplateBinding Content}"
|
||||
ContentStringFormat="{TemplateBinding ContentStringFormat}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border Margin="12,12,12,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="1" BorderBrush="LightGray" CornerRadius="10">
|
||||
<Border.Style>
|
||||
<!-- 鼠标进入或悬停Border时切换颜色(悬停时Border的填充控件必须有填充Border,所在层级不限,仅填充透明Grid则触发器无效) -->
|
||||
<Style TargetType="Border">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="AliceBlue"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MinHeight="120">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="AliceBlue" CornerRadius="12,12,0,0" >
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Grid.Column="0" Margin="8,8,0,8" VerticalAlignment="Center" FontSize="14" Background="Transparent" IsReadOnly="True" Text="店铺单号:" BorderThickness="0" />
|
||||
<TextBox Grid.Column="1" Margin="0,8,8,8" VerticalAlignment="Center" FontSize="14" Background="Transparent" IsReadOnly="True" Text="{Binding order_id}" BorderThickness="0" />
|
||||
<Border Grid.Column="2" Width="12" Background="AliceBlue" Height="12" VerticalAlignment="Center" Cursor="Hand" Tag="{Binding order_id}" MouseLeftButtonDown="Path_MouseLeftButtonDown">
|
||||
<Path Margin="0,0,0,0" Fill="#409eff" Tag="{Binding order_id}" MouseLeftButtonDown="Path_MouseLeftButtonDown" Data="M80 432a128 128 0 0 1 128-128h384a128 128 0 0 1 128 128v384a128 128 0 0 1-128 128h-384a128 128 0 0 1-128-128v-384z m128-64a64 64 0 0 0-64 64v384a64 64 0 0 0 64 64h384a64 64 0 0 0 64-64v-384a64 64 0 0 0-64-64h-384z M816 144h-384a64 64 0 0 0-64 64 32 32 0 0 1-64 0 128 128 0 0 1 128-128h384a128 128 0 0 1 128 128v384a128 128 0 0 1-128 128 32 32 0 0 1 0-64 64 64 0 0 0 64-64v-384a64 64 0 0 0-64-64z" Stretch="Uniform" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border Grid.Row="1" Background="Transparent" CornerRadius="0,0,12,12" >
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
<RowDefinition Height="auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -1,6 +1,8 @@
|
||||
using AllBase;
|
||||
using AllBase.Extension;
|
||||
using AllBase.Model;
|
||||
using NaiBa.Util;
|
||||
using NaiBa.Util.Extension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -24,11 +26,13 @@ namespace _29WxOrderWpf
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public ObservableCollection<oms_wei_order_info> lstOrder = new ObservableCollection<oms_wei_order_info>();
|
||||
public ObservableCollection<oms_wei_order_info> lstOrder { get; set; } = new ObservableCollection<oms_wei_order_info>();
|
||||
public List<oms_wei_order_info> lstOrder1 { get; set; } = new List<oms_wei_order_info>();
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
//DataContext = this;
|
||||
|
||||
this.Height = 800;
|
||||
this.Width = 1600;
|
||||
@@ -42,10 +46,14 @@ namespace _29WxOrderWpf
|
||||
//dgOrder.Items.Add(1111111);
|
||||
|
||||
dgOrder.ItemsSource = lstOrder;
|
||||
|
||||
lbxOrder.ItemsSource = lstOrder;
|
||||
for (int i = 0; i < 10000; i++)
|
||||
{
|
||||
lstOrder.Add(new oms_wei_order_info() { id = 1, is_select = false, order_id = "3737033423685556736 " + Randomx.GetId(1000, 10000), shop_name = "媛卡曦工厂优选" });
|
||||
//lstOrder.Add(new oms_wei_order_info() { id = 1, is_select = false, order_id = ("3737033423685556736".ParseToLong() + Randomx.GetId(0,100)).ParseToString(), shop_name = "媛卡曦工厂优选" });
|
||||
lstOrder.Add(new oms_wei_order_info() { id = 1, is_select = false, order_id = Randomx.GetId(1000,10000).ParseToString(), shop_name = "媛卡曦工厂优选" });
|
||||
}
|
||||
lstOrder.SortDesc(o => o.order_id.ParseToLong());
|
||||
}
|
||||
|
||||
private void btnClose_Click(object sender, RoutedEventArgs e)
|
||||
@@ -53,9 +61,10 @@ namespace _29WxOrderWpf
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
private void Path_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
|
||||
var orderId = ((sender as Border)?.Tag).ParseToString();
|
||||
Clipboard.SetText(orderId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,6 +126,7 @@
|
||||
<Compile Include="DouYinModel\Result\DouSubAccountModel.cs" />
|
||||
<Compile Include="DouYinModel\Result\DouYinAfterSaleOrderModel.cs" />
|
||||
<Compile Include="DouYinModel\Result\DouYinOrderModel.cs" />
|
||||
<Compile Include="Extension\SortExtension.cs" />
|
||||
<Compile Include="FileBase.cs" />
|
||||
<Compile Include="GetHtml.cs" />
|
||||
<Compile Include="Helper\GlobalConfig.cs" />
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AllBase.Extension
|
||||
{
|
||||
public static class SortExtension
|
||||
{
|
||||
public static void Sort<T>(this ObservableCollection<T> collection, Func<T, object> keySelector)
|
||||
{
|
||||
var sortedList = collection.OrderBy(keySelector).ToList();
|
||||
for (int i = 0; i < collection.Count; i++)
|
||||
{
|
||||
if (!Equals(collection[i], sortedList[i]))
|
||||
{
|
||||
collection.Move(collection.IndexOf(sortedList[i]), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void SortDesc<T>(this ObservableCollection<T> collection, Func<T, object> keySelector)
|
||||
{
|
||||
var sortedList = collection.OrderByDescending(keySelector).ToList();
|
||||
for (int i = 0; i < collection.Count; i++)
|
||||
{
|
||||
if (!Equals(collection[i], sortedList[i]))
|
||||
{
|
||||
collection.Move(collection.IndexOf(sortedList[i]), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
Reference in new issue
Block a user