10 changed files with 222 additions and 25 deletions
@ -0,0 +1,13 @@ |
|||||
|
<UserControl x:Class="SunlightAggregationManager.View.ActionPage" |
||||
|
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:SunlightAggregationManager.View" |
||||
|
mc:Ignorable="d" |
||||
|
Loaded="UserControl_Loaded" |
||||
|
d:DesignHeight="720" d:DesignWidth="1080"> |
||||
|
<Grid> |
||||
|
|
||||
|
</Grid> |
||||
|
</UserControl> |
||||
@ -0,0 +1,31 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
using System.Windows; |
||||
|
using System.Windows.Controls; |
||||
|
using System.Windows.Data; |
||||
|
using System.Windows.Documents; |
||||
|
using System.Windows.Input; |
||||
|
using System.Windows.Media; |
||||
|
using System.Windows.Media.Imaging; |
||||
|
using System.Windows.Navigation; |
||||
|
using System.Windows.Shapes; |
||||
|
|
||||
|
namespace SunlightAggregationManager.View |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// ActionPage.xaml 的交互逻辑
|
||||
|
/// </summary>
|
||||
|
public partial class ActionPage : UserControl |
||||
|
{ |
||||
|
public ActionPage() |
||||
|
{ |
||||
|
InitializeComponent(); |
||||
|
} |
||||
|
|
||||
|
private void UserControl_Loaded(object sender, RoutedEventArgs e) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,90 @@ |
|||||
|
<UserControl x:Class="SunlightAggregationManager.View.MachinePage" |
||||
|
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:SunlightAggregationManager.View" |
||||
|
xmlns:ConvertMoels="clr-namespace:SunlightAggregationManager.ConvertMoels" |
||||
|
xmlns:lang="clr-namespace:SunlightAggregationManager" |
||||
|
xmlns:viewmodel="clr-namespace:SunlightAggregationManager.ViewModel" |
||||
|
d:DataContext="{d:DesignInstance Type=viewmodel:MainWindowViewModel}" |
||||
|
mc:Ignorable="d" |
||||
|
d:DesignHeight="720" d:DesignWidth="1080"> |
||||
|
<Grid> |
||||
|
<DataGrid x:Name="DataGridmachines" |
||||
|
ItemsSource="{Binding Machines.DefaultView}" |
||||
|
SelectionChanged="DataGridmachines_SelectionChanged" |
||||
|
SelectionMode="Single" |
||||
|
AlternationCount="2" |
||||
|
IsReadOnly="True" |
||||
|
FontSize="26" |
||||
|
Margin="5,5,5,5" |
||||
|
AutoGenerateColumns="False" |
||||
|
MinColumnWidth="30" |
||||
|
HorizontalGridLinesBrush="#FFC9C9C9" |
||||
|
VerticalGridLinesBrush="#FFC9C9C9" |
||||
|
GridLinesVisibility="All" |
||||
|
BorderBrush="#CCCCCC" |
||||
|
BorderThickness="1,1,1,1" |
||||
|
ColumnHeaderHeight="40" |
||||
|
HorizontalContentAlignment="Right" |
||||
|
CanUserReorderColumns="False" |
||||
|
VerticalContentAlignment="Center"> |
||||
|
<DataGrid.RowStyle > |
||||
|
<Style TargetType="{x:Type DataGridRow}"> |
||||
|
<Style.Triggers> |
||||
|
<Trigger Property="ItemsControl.AlternationIndex" Value="0"> |
||||
|
<Setter Property="Background" Value="#FFFFFFFF" /> |
||||
|
<Setter Property="Height" Value="40" /> |
||||
|
</Trigger> |
||||
|
<Trigger Property="ItemsControl.AlternationIndex" Value="1"> |
||||
|
<Setter Property="Background" Value="#FFF0F0F0" /> |
||||
|
<Setter Property="Height" Value="40" /> |
||||
|
</Trigger> |
||||
|
<Trigger Property="IsMouseOver" Value="False"> |
||||
|
</Trigger> |
||||
|
</Style.Triggers> |
||||
|
</Style> |
||||
|
</DataGrid.RowStyle> |
||||
|
<DataGrid.CellStyle> |
||||
|
<Style TargetType="DataGridCell"> |
||||
|
<Setter Property="BorderThickness" Value="0"/> |
||||
|
<Setter Property="MinWidth" Value="20"/> |
||||
|
<Style.Triggers> |
||||
|
<Trigger Property="IsSelected" Value="True"> |
||||
|
<Setter Property="Background" Value="#FFC0C0C0"/> |
||||
|
<Setter Property="BorderBrush" Value="#FFC0C0C0"/> |
||||
|
<Setter Property="Foreground" Value="#000000"/> |
||||
|
</Trigger> |
||||
|
</Style.Triggers> |
||||
|
</Style> |
||||
|
</DataGrid.CellStyle> |
||||
|
<DataGrid.Columns> |
||||
|
<!--列信息绑定--> |
||||
|
<DataGridTextColumn Header="{x:Static lang:ResourceLanguage.information}" Width="200" FontSize="26" |
||||
|
Binding="{Binding Name}" MaxWidth="200" MinWidth="200" CanUserReorder="False"/> |
||||
|
<DataGridTextColumn Header="{x:Static lang:ResourceLanguage.machine}" Width="200" FontSize="26" |
||||
|
Binding="{Binding Machine}" MaxWidth="200" MinWidth="200" CanUserReorder="False"/> |
||||
|
<DataGridTextColumn Header="{x:Static lang:ResourceLanguage.state}" Width="150" FontSize="26" |
||||
|
Binding="{Binding State}" MinWidth="150" CanUserReorder="False"/> |
||||
|
<DataGridTextColumn Header="{x:Static lang:ResourceLanguage.Mode}" Width="150" FontSize="26" |
||||
|
Binding="{Binding Model}" MinWidth="150" CanUserReorder="False"/> |
||||
|
<DataGridTextColumn Header="A" Width="150" FontSize="26" |
||||
|
Binding="{Binding ModelA}" MinWidth="150" CanUserReorder="False"/> |
||||
|
<DataGridTextColumn Header="B" Width="150" FontSize="26" |
||||
|
Binding="{Binding ModelB}" MinWidth="150" CanUserReorder="False"/> |
||||
|
<DataGridTextColumn Header="C" Width="150" FontSize="26" |
||||
|
Binding="{Binding ModelC}" MinWidth="150" CanUserReorder="False"/> |
||||
|
<DataGridTextColumn Header="D" Width="150" FontSize="26" |
||||
|
Binding="{Binding ModelD}" MinWidth="150" CanUserReorder="False"/> |
||||
|
<DataGridTextColumn Header="E" Width="150" FontSize="26" |
||||
|
Binding="{Binding ModelE}" MinWidth="150" CanUserReorder="False"/> |
||||
|
<DataGridTextColumn Header="F" Width="150" FontSize="26" |
||||
|
Binding="{Binding ModelF}" MinWidth="150" CanUserReorder="False"/> |
||||
|
<DataGridTextColumn Header="{x:Static lang:ResourceLanguage.information}" Width="*" FontSize="26" |
||||
|
Binding="{Binding Information}" MinWidth="200" CanUserReorder="False"/> |
||||
|
|
||||
|
</DataGrid.Columns> |
||||
|
</DataGrid> |
||||
|
</Grid> |
||||
|
</UserControl> |
||||
@ -0,0 +1,41 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
using System.Windows; |
||||
|
using System.Windows.Controls; |
||||
|
using System.Windows.Data; |
||||
|
using System.Windows.Documents; |
||||
|
using System.Windows.Input; |
||||
|
using System.Windows.Media; |
||||
|
using System.Windows.Media.Imaging; |
||||
|
using System.Windows.Navigation; |
||||
|
using System.Windows.Shapes; |
||||
|
|
||||
|
namespace SunlightAggregationManager.View |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// MachinePage.xaml 的交互逻辑
|
||||
|
/// </summary>
|
||||
|
public partial class MachinePage : UserControl |
||||
|
{ |
||||
|
public MachinePage() |
||||
|
{ |
||||
|
InitializeComponent(); |
||||
|
} |
||||
|
|
||||
|
private string id = ""; |
||||
|
private void DataGridmachines_SelectionChanged(object sender, SelectionChangedEventArgs e) |
||||
|
{ |
||||
|
int rownum = DataGridmachines.SelectedIndex;//获取鼠标选中行并定义变量
|
||||
|
if (rownum != -1)//判断鼠标定位是否有效
|
||||
|
{ |
||||
|
var row_ = DataGridmachines.Columns[0].GetCellContent(DataGridmachines.Items[rownum]); |
||||
|
if (row_ is TextBlock textBlock) |
||||
|
{ |
||||
|
id = textBlock.Text;//定位第0列,
|
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue