@@ -7,6 +7,7 @@ using System.Data; | |||
using System.Linq; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using BPA.Communication; | |||
namespace BPASmart.ConfigurationSoftware | |||
{ | |||
@@ -20,7 +20,7 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Helper" Version="1.0.8" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.9" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -6,11 +6,11 @@ | |||
xmlns:local="clr-namespace:BPASmart.ConfigurationSoftware" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
Title="MainWindow" | |||
WindowState="Maximized" | |||
Width="800" | |||
Height="450" | |||
Topmost="False" | |||
WindowStartupLocation="CenterScreen" | |||
WindowState="Maximized" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
@@ -136,6 +136,11 @@ | |||
Margin="5" | |||
Content="运行" /> | |||
<Button | |||
Width="60" | |||
Margin="5" | |||
Content="生成" /> | |||
<Button | |||
Width="60" | |||
Margin="5" | |||
@@ -146,62 +151,122 @@ | |||
<Grid Grid.Row="1"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="150" /> | |||
<ColumnDefinition Width="5" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Grid> | |||
<Border BorderThickness="2" BorderBrush="Blue"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="20" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
Text="{Binding Head}"> | |||
<TextBlock.ContextMenu> | |||
<ContextMenu> | |||
<MenuItem Command="{Binding NewPageCommand}" Header="新建页面" /> | |||
</ContextMenu> | |||
</TextBlock.ContextMenu> | |||
</TextBlock> | |||
<ScrollViewer | |||
Grid.Row="1" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding Pages}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<RadioButton | |||
Command="{Binding DataContext.SelectedPageCommand, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}" | |||
CommandParameter="{Binding}" | |||
Content="{Binding}" | |||
GroupName="All" | |||
Style="{StaticResource RadioMiniButtonStyle}"> | |||
<RadioButton.ContextMenu> | |||
<ContextMenu> | |||
<MenuItem Header="删除页面" /> | |||
<MenuItem Header="设为启动界面" /> | |||
<MenuItem Header="重命名" /> | |||
</ContextMenu> | |||
</RadioButton.ContextMenu> | |||
</RadioButton> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</Border> | |||
<GridSplitter | |||
Grid.Row="2" | |||
Width="2" | |||
VerticalAlignment="Stretch" | |||
Background="Blue" /> | |||
<Grid | |||
Name="gr" | |||
Grid.Row="1" | |||
Grid.Column="2" | |||
Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="20" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
<RowDefinition Height="2" /> | |||
<RowDefinition Height="100" /> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
Text="{Binding Head}"> | |||
<TextBlock.ContextMenu> | |||
<ContextMenu> | |||
<MenuItem Command="{Binding NewPageCommand}" Header="新建页面" /> | |||
</ContextMenu> | |||
</TextBlock.ContextMenu> | |||
</TextBlock> | |||
<ScrollViewer | |||
<ContentControl | |||
Grid.Row="1" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding Pages}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<RadioButton | |||
Command="{Binding DataContext.SelectedPageCommand, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}" | |||
CommandParameter="{Binding}" | |||
Content="{Binding}" | |||
GroupName="All" | |||
Style="{StaticResource RadioMiniButtonStyle}"> | |||
<RadioButton.ContextMenu> | |||
<ContextMenu> | |||
<MenuItem Header="删除页面" /> | |||
<MenuItem Header="设为启动界面" /> | |||
<MenuItem Header="重命名" /> | |||
</ContextMenu> | |||
</RadioButton.ContextMenu> | |||
</RadioButton> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
Width="auto" | |||
Height="auto" | |||
Content="{Binding MainContent}" Margin="0,0,0,5" Grid.RowSpan="3" /> | |||
<Border | |||
Grid.Row="3" | |||
Grid.RowSpan="2" | |||
Margin="-7 0 0 0" | |||
BorderBrush="Blue" | |||
BorderThickness="2"> | |||
<Grid Margin="5,5,0,0"> | |||
<ScrollViewer> | |||
<ItemsControl ItemsSource="{Binding Message}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<TextBlock | |||
FontSize="16" | |||
Foreground="Blue" | |||
Text="{Binding}" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</Border> | |||
<GridSplitter | |||
Grid.Row="2" | |||
Height="2" | |||
HorizontalAlignment="Stretch" | |||
Background="Blue" Grid.RowSpan="2" /> | |||
</Grid> | |||
<ContentControl | |||
<!--<ContentControl | |||
Grid.Row="1" | |||
Grid.Column="1" | |||
Width="auto" | |||
Height="auto" | |||
Content="{Binding MainContent}" /> | |||
Content="{Binding MainContent}" />--> | |||
<!--<Canvas Name="cav" Grid.Column="1" Grid.Row="1"> | |||
</Canvas>--> | |||
@@ -15,52 +15,20 @@ using BeDesignerSCADA.Controls; | |||
using System.Windows; | |||
using System.Reflection; | |||
using System.Collections.Concurrent; | |||
using System.IO.Pipes; | |||
using BPA.Communication; | |||
using System.Threading; | |||
namespace BPASmart.ConfigurationSoftware | |||
{ | |||
public class MainWindowViewModel : NoticeBase | |||
{ | |||
//public ushort CalcCRC(byte[] bytes) | |||
//{ | |||
// ushort uiCrcValue = 0xffff; | |||
// ushort polynomial = 0x8408; | |||
// for (int i = 0; i < bytes.Length; i++) | |||
// { | |||
// uiCrcValue = (ushort)(uiCrcValue ^ bytes[i]); | |||
// for (int m = 0; m < 8; m++) | |||
// { | |||
// if ((uiCrcValue & 0x0001) == 1) | |||
// { | |||
// uiCrcValue = (ushort)((uiCrcValue >> 1) ^ polynomial); | |||
// } | |||
// else | |||
// { | |||
// uiCrcValue = (ushort)(uiCrcValue >> 1); | |||
// } | |||
// } | |||
// } | |||
// return uiCrcValue; | |||
//} | |||
//public byte[] GetCrc(ushort value, bool IsReverse = true) | |||
//{ | |||
// byte[] bytes = new byte[2]; | |||
// if (IsReverse) | |||
// { | |||
// bytes[0] = (byte)value; | |||
// bytes[1] = (byte)(value >> 8); | |||
// } | |||
// else | |||
// { | |||
// bytes[1] = (byte)value; | |||
// bytes[0] = (byte)(value >> 8); | |||
// } | |||
// return bytes; | |||
//} | |||
PipeServer pipeServer = new PipeServer(PipeTopic.PipeName); | |||
ConcurrentQueue<string> msg = new ConcurrentQueue<string>(); | |||
public MainWindowViewModel() | |||
{ | |||
MessageLog.GetInstance.NotifyShow = new Action<string>((o) => { App.Current.Dispatcher.Invoke(() => { Message.Add(o); }); }); | |||
MessageLog.GetInstance.NotifyShowEx = new Action<string>((o) => { App.Current.Dispatcher.Invoke(() => { Message.Add(o); }); }); | |||
Init(); | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
@@ -83,6 +51,7 @@ namespace BPASmart.ConfigurationSoftware | |||
Directory.CreateDirectory(path); | |||
Json<ProjectModel>.Data.ProjectPath = path; | |||
Json<ProjectModel>.Data.ProjectName = objModel.ProjectName; | |||
FileConfigModel.ConstPath = objModel.ProjectPath; | |||
Head = objModel.ProjectName; | |||
Save(); | |||
FileHelper.GetInstance.RegisterOpenFileType(); | |||
@@ -121,12 +90,17 @@ namespace BPASmart.ConfigurationSoftware | |||
PageName = o.ToString(), | |||
}); | |||
} | |||
var res = mainCanvasPanels.FirstOrDefault(p => p.PageName == o.ToString()); | |||
if (res != null) | |||
int index = Array.FindIndex(mainCanvasPanels.ToArray(), p => p.PageName == o.ToString()); | |||
if (index >= 0 && index < mainCanvasPanels.Count) | |||
{ | |||
MainContent = res.MainCanvasPanelModel; | |||
mainCanvasPanels.ElementAt(index).MainCanvasPanelModel.VariableManagerPath(FileConfigModel.VarConfigPath); | |||
MainContent = mainCanvasPanels.ElementAt(index).MainCanvasPanelModel; | |||
} | |||
//var res = mainCanvasPanels.FirstOrDefault(p => p.PageName == o.ToString()); | |||
//if (res != null) | |||
//{ | |||
// MainContent = res.MainCanvasPanelModel; | |||
//} | |||
}); | |||
SaveProjectCommand = new RelayCommand(() => | |||
@@ -136,11 +110,35 @@ namespace BPASmart.ConfigurationSoftware | |||
mainCanvasPanels.ElementAt(i).MainCanvasPanelModel.FileSave(); | |||
} | |||
Save(); | |||
MessageLog.GetInstance.Show("项目保存成功"); | |||
}); | |||
} | |||
private void Init() | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
while (msg.Count > 0) | |||
{ | |||
if (msg.TryDequeue(out string s)) | |||
{ | |||
if (s == PipeTopic.VarSave) | |||
{ | |||
for (int i = 0; i < mainCanvasPanels.Count; i++) | |||
{ | |||
mainCanvasPanels.ElementAt(i).MainCanvasPanelModel.VariableManagerPath(FileConfigModel.VarConfigPath); | |||
} | |||
} | |||
else | |||
{ | |||
MessageLog.GetInstance.Show(s); | |||
} | |||
} | |||
} | |||
Thread.Sleep(100); | |||
}), "管道消息控制"); | |||
pipeServer.PushCommand = new Action<string>((o) => { msg.Enqueue(o); }); | |||
pipeServer.StartPipeStream(); | |||
if (Json<ProjectModel>.Data.ProjectName != null && Json<ProjectModel>.Data.ProjectName.Length > 0) | |||
{ | |||
Head = Json<ProjectModel>.Data.ProjectName; | |||
@@ -185,6 +183,8 @@ namespace BPASmart.ConfigurationSoftware | |||
public ObservableCollection<string> Pages { get; set; } = new ObservableCollection<string>(); | |||
public ObservableCollection<string> Message { get; set; } = new ObservableCollection<string>(); | |||
} | |||
} |
@@ -12,9 +12,9 @@ namespace BPASmart.Model | |||
public static string ConstPath { get; set; } = string.Empty; | |||
/// <summary> | |||
/// Json文件配置路径 | |||
/// 变量配置路径 | |||
/// </summary> | |||
public static string JsonPath | |||
public static string VarConfigPath | |||
{ | |||
get | |||
{ | |||
@@ -0,0 +1,18 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.Model | |||
{ | |||
/// <summary> | |||
/// 管道主题 | |||
/// </summary> | |||
public class PipeTopic | |||
{ | |||
public const string PipeName = "ConfigurationPipe"; | |||
public const string VarSave = "VarSave"; | |||
} | |||
} |
@@ -8,8 +8,8 @@ | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Communication" Version="1.0.13" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.8" /> | |||
<PackageReference Include="BPA.Communication" Version="1.0.17" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.9" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -131,12 +131,12 @@ namespace BPASmart.VariableManager | |||
private void DataSave() | |||
{ | |||
Json<CommunicationPar>.Save(FileConfigModel.JsonPath); | |||
Json<CommunicationPar>.Save(FileConfigModel.VarConfigPath); | |||
} | |||
private void DataRead() | |||
{ | |||
Json<CommunicationPar>.Read(FileConfigModel.JsonPath); | |||
Json<CommunicationPar>.Read(FileConfigModel.VarConfigPath); | |||
} | |||
} | |||
@@ -29,8 +29,8 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Communication" Version="1.0.13" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.8" /> | |||
<PackageReference Include="BPA.Communication" Version="1.0.17" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.9" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -20,12 +20,12 @@ namespace BPASmart.VariableManager.ViewModels | |||
{ | |||
public CommunicationSetViewModel() | |||
{ | |||
Json<CommunicationPar>.Read(FileConfigModel.JsonPath); | |||
Json<CommunicationPar>.Read(FileConfigModel.VarConfigPath); | |||
communicationDevices = Json<CommunicationPar>.Data.CommunicationDevices; | |||
DataListInit(); | |||
NewConnectCommand = new RelayCommand(() => { NewConnect(); }); | |||
RemoveDeviceCommand = new RelayCommand<object>(RemoveDevice); | |||
SaveConnectSetCommand = new RelayCommand(() => { Json<CommunicationPar>.Save(FileConfigModel.JsonPath); }); | |||
SaveConnectSetCommand = new RelayCommand(() => { Json<CommunicationPar>.Save(FileConfigModel.VarConfigPath); }); | |||
DelegationNotifi.GetInstance.AddDeviceVerify = new Func<DeviceManagermentResult, bool>((p) => | |||
{ | |||
@@ -21,13 +21,24 @@ namespace BPASmart.VariableManager.ViewModels | |||
{ | |||
public class VariableConfigViewModel : NoticeBase | |||
{ | |||
PipeClient pipeClient = new PipeClient(PipeTopic.PipeName); | |||
private int varialeInfosIndex = -1; | |||
ICommunicationDevice DeviceType; | |||
public VariableConfigViewModel(string o) | |||
{ | |||
pipeClient.StartPipeStream(); | |||
MessageLog.GetInstance.NotifyShow = new Action<string>((o) => { if (pipeClient.IsConnected) pipeClient.SendCommand(o); }); | |||
DataInit(o); | |||
VarNameChanged(); | |||
DelegationNotifi.GetInstance.VariableSave = new Action(() => { Json<CommunicationPar>.Save(); }); | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
Json<CommunicationPar>.Save(FileConfigModel.VarConfigPath); | |||
pipeClient.SendCommand(PipeTopic.VarSave); | |||
MessageLog.GetInstance.Show("变量保存成功"); | |||
}); | |||
//DelegationNotifi.GetInstance.VariableSave = new Action(() => { Json<CommunicationPar>.Save(); }); | |||
StartMotionCommand = new RelayCommand(() => | |||
{ | |||
switch (ButtonContext) | |||
@@ -30,7 +30,7 @@ namespace BPASmart.VariableManager.Views | |||
private void CommunicationSetView_Unloaded(object sender, RoutedEventArgs e) | |||
{ | |||
Json<CommunicationPar>.Save(FileConfigModel.JsonPath); | |||
Json<CommunicationPar>.Save(FileConfigModel.VarConfigPath); | |||
} | |||
} | |||
} |
@@ -33,7 +33,7 @@ namespace BPASmart.VariableManager.Views | |||
private void VariableConfig_Unloaded(object sender, RoutedEventArgs e) | |||
{ | |||
Json<CommunicationPar>.Save(FileConfigModel.JsonPath); | |||
Json<CommunicationPar>.Save(FileConfigModel.VarConfigPath); | |||
} | |||
private void VariableConfig_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) | |||
@@ -33,8 +33,8 @@ | |||
</ListBox> | |||
</Border> | |||
</Grid> | |||
<!--中间控制区域--> | |||
<DockPanel Grid.Column="1"> | |||
@@ -139,7 +139,7 @@ | |||
<!--中间画布--> | |||
<Border BorderThickness="1" BorderBrush="{StaticResource AccentBrush}" Margin="4"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="/Images/bj.png" Stretch="UniformToFill"/> | |||
<ImageBrush ImageSource="../Images/bj.png" Stretch="UniformToFill"/> | |||
</Border.Background> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
@@ -261,8 +261,8 @@ | |||
<mypro:PropertyDefinition DisplayName="接收消息集" Category="事件绑定" DisplayOrder="5" Name="EventReceiveNameList" /> | |||
<mypro:PropertyDefinition DisplayName="出料单击事件" Category="事件绑定" DisplayOrder="6" Name="出料单击事件" /> | |||
<mypro:PropertyDefinition DisplayName="停止出料单击事件" Category="事件绑定" DisplayOrder="7" Name="停止出料单击事件" /> | |||
</mypro:PropertyGrid.PropertyDefinitions> | |||
<mypro:PropertyGrid.EditorDefinitions> | |||
@@ -9,8 +9,8 @@ | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Communication" Version="1.0.13" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.8" /> | |||
<PackageReference Include="BPA.Communication" Version="1.0.17" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.9" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -33,6 +33,9 @@ | |||
this.label1 = new System.Windows.Forms.Label(); | |||
this.button3 = new System.Windows.Forms.Button(); | |||
this.button4 = new System.Windows.Forms.Button(); | |||
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); | |||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); | |||
this.splitContainer1.SuspendLayout(); | |||
this.SuspendLayout(); | |||
// | |||
// button1 | |||
@@ -84,11 +87,20 @@ | |||
this.button4.UseVisualStyleBackColor = true; | |||
this.button4.Click += new System.EventHandler(this.button4_Click); | |||
// | |||
// splitContainer1 | |||
// | |||
this.splitContainer1.Location = new System.Drawing.Point(408, 158); | |||
this.splitContainer1.Name = "splitContainer1"; | |||
this.splitContainer1.Size = new System.Drawing.Size(150, 100); | |||
this.splitContainer1.SplitterDistance = 45; | |||
this.splitContainer1.TabIndex = 5; | |||
// | |||
// Form1 | |||
// | |||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); | |||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |||
this.ClientSize = new System.Drawing.Size(641, 298); | |||
this.Controls.Add(this.splitContainer1); | |||
this.Controls.Add(this.button4); | |||
this.Controls.Add(this.button3); | |||
this.Controls.Add(this.label1); | |||
@@ -96,6 +108,8 @@ | |||
this.Controls.Add(this.button1); | |||
this.Name = "Form1"; | |||
this.Text = "Form1"; | |||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); | |||
this.splitContainer1.ResumeLayout(false); | |||
this.ResumeLayout(false); | |||
this.PerformLayout(); | |||
@@ -108,5 +122,6 @@ | |||
private Label label1; | |||
private Button button3; | |||
private Button button4; | |||
private SplitContainer splitContainer1; | |||
} | |||
} |
@@ -3,6 +3,6 @@ | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:local="clr-namespace:WPFDemo" | |||
StartupUri="TestData.xaml"> | |||
StartupUri="Window1.xaml"> | |||
<Application.Resources /> | |||
</Application> |
@@ -5,14 +5,13 @@ | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:WPFDemo" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
Title="TestData" | |||
Width="800" | |||
Height="450" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<local:Class1/> | |||
<local:Class1 /> | |||
</Window.DataContext> | |||
<Grid> | |||
@@ -23,18 +22,25 @@ | |||
<Grid> | |||
<StackPanel Orientation="Horizontal"> | |||
<Button Margin="5,0" Content="添加数据记录" Command="{Binding AddCommand}"/> | |||
<Button Margin="5,0" Content="保存数据记录" Click="Button_Click_1"/> | |||
<Button | |||
Margin="5,0" | |||
Command="{Binding AddCommand}" | |||
Content="添加数据记录" /> | |||
<Button | |||
Margin="5,0" | |||
Click="Button_Click_1" | |||
Content="保存数据记录" /> | |||
</StackPanel> | |||
</Grid> | |||
<DataGrid Grid.Row="1" AutoGenerateColumns="True" ItemsSource="{Binding dataTests}" > | |||
<DataGrid | |||
Grid.Row="1" | |||
AutoGenerateColumns="True" | |||
ItemsSource="{Binding dataTests}"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
</DataTemplate> | |||
<DataTemplate /> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
</DataGrid.Columns> | |||
@@ -0,0 +1,60 @@ | |||
<Window | |||
x:Class="WPFDemo.Window1" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:WPFDemo" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
Title="Window1" | |||
Width="800" | |||
Height="450" | |||
mc:Ignorable="d"> | |||
<Grid> | |||
<Grid.RowDefinitions /> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="10" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Row="0" | |||
Grid.Column="0" | |||
Text="LLLLLLLLLLLLLL" /> | |||
<GridSplitter | |||
Grid.Row="0" | |||
Grid.Column="1" | |||
Width="10" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Stretch" | |||
Background="Wheat" | |||
DragDelta="GridSplitter_DragDelta" /> | |||
<Grid Grid.Row="0" Grid.Column="2"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition Height="10" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Row="0" | |||
Grid.Column="0" | |||
Text="RRRRRRTTTTTTTT" /> | |||
<GridSplitter | |||
Grid.Row="1" | |||
Grid.Column="0" | |||
Height="10" | |||
HorizontalAlignment="Stretch" | |||
Background="Wheat" /> | |||
<TextBlock | |||
Grid.Row="2" | |||
Grid.Column="0" | |||
Text="RRRRRRBBBBBBBB" /> | |||
</Grid> | |||
</Grid> | |||
</Window> |
@@ -0,0 +1,32 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
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.Shapes; | |||
namespace WPFDemo | |||
{ | |||
/// <summary> | |||
/// Window1.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class Window1 : Window | |||
{ | |||
public Window1() | |||
{ | |||
InitializeComponent(); | |||
} | |||
private void GridSplitter_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) | |||
{ | |||
} | |||
} | |||
} |