1
This commit is contained in:
parent
763a3893d6
commit
2004876770
@ -23,7 +23,7 @@ namespace CPF.Toolkit.Demo
|
|||||||
this.Width = 1280;
|
this.Width = 1280;
|
||||||
this.Height = 720;
|
this.Height = 720;
|
||||||
this.Background = null;
|
this.Background = null;
|
||||||
this.Children.Add(new WindowFrame(this, new Panel
|
var frame = this.Children.Add(new WindowFrame(this, new Panel
|
||||||
{
|
{
|
||||||
Size = SizeField.Fill,
|
Size = SizeField.Fill,
|
||||||
Background = "204,204,204",
|
Background = "204,204,204",
|
||||||
@ -32,13 +32,23 @@ namespace CPF.Toolkit.Demo
|
|||||||
new MdiWindow
|
new MdiWindow
|
||||||
{
|
{
|
||||||
Title = "test",
|
Title = "test",
|
||||||
Content = new Button
|
//Content = new WrapPanel
|
||||||
{
|
//{
|
||||||
Content = "test"
|
// Children =
|
||||||
},
|
// {
|
||||||
|
// new Button{ Content = "test" ,Width = 100, Height = 35 },
|
||||||
|
// new Button{ Content = "test" ,Width = 100, Height = 35 },
|
||||||
|
// new Button{ Content = "test" ,Width = 100, Height = 35 },
|
||||||
|
// new Button{ Content = "test" ,Width = 100, Height = 35 },
|
||||||
|
// },
|
||||||
|
//},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
frame.CaptionBackgrund = "white";
|
||||||
|
frame.CaptionForeground = "black";
|
||||||
|
frame.ControlBoxStroke = "black";
|
||||||
|
frame.MaximizeBox = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
223
CPF.Toolkit/Controls/MdiFrame.cs
Normal file
223
CPF.Toolkit/Controls/MdiFrame.cs
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
using CPF.Controls;
|
||||||
|
using CPF.Drawing;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace CPF.Toolkit.Controls
|
||||||
|
{
|
||||||
|
internal class MdiFrame : Control
|
||||||
|
{
|
||||||
|
public MdiFrame()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.Children.Add(new Grid
|
||||||
|
{
|
||||||
|
Size = SizeField.Fill,
|
||||||
|
RowDefinitions =
|
||||||
|
{
|
||||||
|
new RowDefinition{ Height = 35 },
|
||||||
|
new RowDefinition{ },
|
||||||
|
},
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new Thumb
|
||||||
|
{
|
||||||
|
Size = SizeField.Fill,
|
||||||
|
Background = new LinearGradientFill
|
||||||
|
{
|
||||||
|
EndPoint = "0,100%",
|
||||||
|
GradientStops =
|
||||||
|
{
|
||||||
|
new GradientStop("152,180,208",0),
|
||||||
|
new GradientStop("181,206,231",1),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Child = new Panel
|
||||||
|
{
|
||||||
|
Size = SizeField.Fill,
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new StackPanel
|
||||||
|
{
|
||||||
|
Orientation = Orientation.Horizontal,
|
||||||
|
MarginLeft = 0,
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new TextBlock
|
||||||
|
{
|
||||||
|
[nameof(TextBlock.Text)] = new BindingDescribe(this,nameof(this.Title),BindingMode.OneWay),
|
||||||
|
FontSize = 14,
|
||||||
|
MarginLeft = 10,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new StackPanel
|
||||||
|
{
|
||||||
|
Orientation = Orientation.Horizontal,
|
||||||
|
MarginRight = 0,
|
||||||
|
Height = "100%",
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new SystemButton
|
||||||
|
{
|
||||||
|
Name = "min",
|
||||||
|
Size = new SizeField(30,"100%"),
|
||||||
|
Content = new Line
|
||||||
|
{
|
||||||
|
MarginTop = 5,
|
||||||
|
MarginLeft = "auto",
|
||||||
|
StartPoint = new Point(1,13),
|
||||||
|
EndPoint = new Point(14,13),
|
||||||
|
StrokeStyle = "2",
|
||||||
|
IsAntiAlias = true,
|
||||||
|
StrokeFill = "black"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Panel
|
||||||
|
{
|
||||||
|
Height = "100%",
|
||||||
|
Bindings =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
nameof(Visibility),
|
||||||
|
nameof(MaximizeBox),
|
||||||
|
this,
|
||||||
|
BindingMode.OneWay,
|
||||||
|
a => (bool)a ? Visibility.Visible : Visibility.Collapsed
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new SystemButton
|
||||||
|
{
|
||||||
|
Name = "max",
|
||||||
|
Size = new SizeField(30,"100%"),
|
||||||
|
Content = new Rectangle
|
||||||
|
{
|
||||||
|
Size = new SizeField(14,12),
|
||||||
|
MarginTop = 10,
|
||||||
|
StrokeStyle = "2",
|
||||||
|
},
|
||||||
|
Commands =
|
||||||
|
{
|
||||||
|
{ nameof(Button.Click),(s,e) => this.WindowState = WindowState.Maximized }
|
||||||
|
},
|
||||||
|
Bindings =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
nameof(Border.Visibility),
|
||||||
|
nameof(this.WindowState),
|
||||||
|
this,
|
||||||
|
BindingMode.OneWay,
|
||||||
|
a => (WindowState)a == WindowState.Maximized || (WindowState)a == WindowState.FullScreen ? Visibility.Collapsed : Visibility.Visible
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new SystemButton
|
||||||
|
{
|
||||||
|
Name = "nor",
|
||||||
|
Visibility = Visibility.Collapsed,
|
||||||
|
Size = new SizeField(30,"100%"),
|
||||||
|
Content = new Panel
|
||||||
|
{
|
||||||
|
Size = SizeField.Fill,
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new Rectangle
|
||||||
|
{
|
||||||
|
MarginTop = 15,
|
||||||
|
MarginLeft =8,
|
||||||
|
Size = new SizeField(11,8),
|
||||||
|
StrokeStyle = "1.5",
|
||||||
|
},
|
||||||
|
new Polyline
|
||||||
|
{
|
||||||
|
MarginTop =11,
|
||||||
|
MarginLeft = 12,
|
||||||
|
Points =
|
||||||
|
{
|
||||||
|
new Point(0,3),
|
||||||
|
new Point(0,0),
|
||||||
|
new Point(9,0),
|
||||||
|
new Point(9,7),
|
||||||
|
new Point(6,7)
|
||||||
|
},
|
||||||
|
StrokeStyle = "2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Commands =
|
||||||
|
{
|
||||||
|
{ nameof(Button.Click),(s,e) => this.WindowState = WindowState.Normal }
|
||||||
|
},
|
||||||
|
Bindings =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
nameof(Border.Visibility),
|
||||||
|
nameof(Window.WindowState),
|
||||||
|
this,
|
||||||
|
BindingMode.OneWay,
|
||||||
|
a => (WindowState)a == WindowState.Normal ? Visibility.Collapsed : Visibility.Visible
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new SystemButton
|
||||||
|
{
|
||||||
|
Name = "close",
|
||||||
|
Size = new SizeField(30,"100%"),
|
||||||
|
Content = new Panel
|
||||||
|
{
|
||||||
|
Size = SizeField.Fill,
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new Line
|
||||||
|
{
|
||||||
|
MarginTop=10,
|
||||||
|
MarginLeft=8,
|
||||||
|
StartPoint = new Point(1, 1),
|
||||||
|
EndPoint = new Point(14, 13),
|
||||||
|
StrokeStyle = "2",
|
||||||
|
IsAntiAlias=true,
|
||||||
|
},
|
||||||
|
new Line
|
||||||
|
{
|
||||||
|
MarginTop=10,
|
||||||
|
MarginLeft=8,
|
||||||
|
StartPoint = new Point(14, 1),
|
||||||
|
EndPoint = new Point(1, 13),
|
||||||
|
StrokeStyle = "2",
|
||||||
|
IsAntiAlias=true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}.Assign(out var thumb),
|
||||||
|
new Panel
|
||||||
|
{
|
||||||
|
Attacheds = { { Grid.RowIndex,1 } },
|
||||||
|
BorderFill = "186,210,234",
|
||||||
|
BorderType = BorderType.BorderThickness,
|
||||||
|
BorderThickness = new Thickness(5,0,5,5),
|
||||||
|
Size = SizeField.Fill,
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,52 +3,255 @@ using CPF.Animation;
|
|||||||
using CPF.Charts;
|
using CPF.Charts;
|
||||||
using CPF.Controls;
|
using CPF.Controls;
|
||||||
using CPF.Drawing;
|
using CPF.Drawing;
|
||||||
|
using CPF.Input;
|
||||||
using CPF.Platform;
|
using CPF.Platform;
|
||||||
using CPF.Shapes;
|
using CPF.Shapes;
|
||||||
using CPF.Styling;
|
using CPF.Styling;
|
||||||
using CPF.Svg;
|
using CPF.Svg;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace CPF.Toolkit.Controls
|
namespace CPF.Toolkit.Controls
|
||||||
{
|
{
|
||||||
public class MdiWindow : Control, IWindow
|
public class MdiWindow : Control
|
||||||
{
|
{
|
||||||
public WindowState WindowState { get => GetValue<WindowState>(); set => SetValue(value); }
|
public WindowState WindowState { get => GetValue<WindowState>(); set => SetValue(value); }
|
||||||
public Image Icon { get => GetValue<Image>(); set => SetValue(value); }
|
public Image Icon { get => GetValue<Image>(); set => SetValue(value); }
|
||||||
public string Title { get => GetValue<string>(); set => SetValue(value); }
|
public string Title { get => GetValue<string>(); set => SetValue(value); }
|
||||||
public UIElement Content { get => GetValue<UIElement>(); set => SetValue(value); }
|
public UIElement Content { get => GetValue<UIElement>(); set => SetValue(value); }
|
||||||
//protected override UIElementCollection Children => throw new NotImplementedException();
|
[PropertyMetadata(true)]
|
||||||
WindowFrame frame;
|
public bool MaximizeBox { get { return GetValue<bool>(); } set { SetValue(value); } }
|
||||||
|
[PropertyMetadata(true)]
|
||||||
|
public bool MinimizeBox { get { return GetValue<bool>(); } set { SetValue(value); } }
|
||||||
|
|
||||||
SizeField normalSize = new SizeField(500, 500);
|
SizeField normalSize = new SizeField(500, 500);
|
||||||
public void Close()
|
Point normalPos = new Point(0, 0);
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DragMove()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void InitializeComponent()
|
protected override void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.Size = this.normalSize;
|
this.Size = normalSize;
|
||||||
this.frame = base.Children.Add(new WindowFrame(this, this.Content));
|
this.Background = "white";
|
||||||
frame.MaximizeBox = true;
|
this.BorderFill = "179,179,179";
|
||||||
|
this.BorderStroke = "1";
|
||||||
|
this.MarginLeft = 0;
|
||||||
|
this.MarginTop = 0;
|
||||||
|
base.Children.Add(new Grid
|
||||||
|
{
|
||||||
|
Size = SizeField.Fill,
|
||||||
|
RowDefinitions =
|
||||||
|
{
|
||||||
|
new RowDefinition{ Height = 35 },
|
||||||
|
new RowDefinition{ },
|
||||||
|
},
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new Thumb
|
||||||
|
{
|
||||||
|
Size = SizeField.Fill,
|
||||||
|
Background = new LinearGradientFill
|
||||||
|
{
|
||||||
|
EndPoint = "0,100%",
|
||||||
|
GradientStops =
|
||||||
|
{
|
||||||
|
new GradientStop("152,180,208",0),
|
||||||
|
new GradientStop("181,206,231",1),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Child = new Panel
|
||||||
|
{
|
||||||
|
Size = SizeField.Fill,
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new StackPanel
|
||||||
|
{
|
||||||
|
Orientation = Orientation.Horizontal,
|
||||||
|
MarginLeft = 0,
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new TextBlock
|
||||||
|
{
|
||||||
|
[nameof(TextBlock.Text)] = new BindingDescribe(this,nameof(this.Title),BindingMode.OneWay),
|
||||||
|
FontSize = 14,
|
||||||
|
MarginLeft = 10,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new StackPanel
|
||||||
|
{
|
||||||
|
Orientation = Orientation.Horizontal,
|
||||||
|
MarginRight = 0,
|
||||||
|
Height = "100%",
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new SystemButton
|
||||||
|
{
|
||||||
|
Name = "min",
|
||||||
|
Size = new SizeField(30,"100%"),
|
||||||
|
Content = new Line
|
||||||
|
{
|
||||||
|
MarginTop = 5,
|
||||||
|
MarginLeft = "auto",
|
||||||
|
StartPoint = new Point(1,13),
|
||||||
|
EndPoint = new Point(14,13),
|
||||||
|
StrokeStyle = "2",
|
||||||
|
IsAntiAlias = true,
|
||||||
|
StrokeFill = "black"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Panel
|
||||||
|
{
|
||||||
|
Height = "100%",
|
||||||
|
Bindings =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
nameof(Visibility),
|
||||||
|
nameof(MaximizeBox),
|
||||||
|
this,
|
||||||
|
BindingMode.OneWay,
|
||||||
|
a => (bool)a ? Visibility.Visible : Visibility.Collapsed
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new SystemButton
|
||||||
|
{
|
||||||
|
Name = "max",
|
||||||
|
Size = new SizeField(30,"100%"),
|
||||||
|
Content = new Rectangle
|
||||||
|
{
|
||||||
|
Size = new SizeField(14,12),
|
||||||
|
MarginTop = 10,
|
||||||
|
StrokeStyle = "2",
|
||||||
|
},
|
||||||
|
Commands =
|
||||||
|
{
|
||||||
|
{ nameof(Button.Click),(s,e) => this.WindowState = WindowState.Maximized }
|
||||||
|
},
|
||||||
|
Bindings =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
nameof(Border.Visibility),
|
||||||
|
nameof(this.WindowState),
|
||||||
|
this,
|
||||||
|
BindingMode.OneWay,
|
||||||
|
a => (WindowState)a == WindowState.Maximized || (WindowState)a == WindowState.FullScreen ? Visibility.Collapsed : Visibility.Visible
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new SystemButton
|
||||||
|
{
|
||||||
|
Name = "nor",
|
||||||
|
Visibility = Visibility.Collapsed,
|
||||||
|
Size = new SizeField(30,"100%"),
|
||||||
|
Content = new Panel
|
||||||
|
{
|
||||||
|
Size = SizeField.Fill,
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new Rectangle
|
||||||
|
{
|
||||||
|
MarginTop = 15,
|
||||||
|
MarginLeft =8,
|
||||||
|
Size = new SizeField(11,8),
|
||||||
|
StrokeStyle = "1.5",
|
||||||
|
},
|
||||||
|
new Polyline
|
||||||
|
{
|
||||||
|
MarginTop =11,
|
||||||
|
MarginLeft = 12,
|
||||||
|
Points =
|
||||||
|
{
|
||||||
|
new Point(0,3),
|
||||||
|
new Point(0,0),
|
||||||
|
new Point(9,0),
|
||||||
|
new Point(9,7),
|
||||||
|
new Point(6,7)
|
||||||
|
},
|
||||||
|
StrokeStyle = "2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Commands =
|
||||||
|
{
|
||||||
|
{ nameof(Button.Click),(s,e) => this.WindowState = WindowState.Normal }
|
||||||
|
},
|
||||||
|
Bindings =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
nameof(Border.Visibility),
|
||||||
|
nameof(Window.WindowState),
|
||||||
|
this,
|
||||||
|
BindingMode.OneWay,
|
||||||
|
a => (WindowState)a == WindowState.Normal ? Visibility.Collapsed : Visibility.Visible
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new SystemButton
|
||||||
|
{
|
||||||
|
Name = "close",
|
||||||
|
Size = new SizeField(30,"100%"),
|
||||||
|
Content = new Panel
|
||||||
|
{
|
||||||
|
Size = SizeField.Fill,
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new Line
|
||||||
|
{
|
||||||
|
MarginTop=10,
|
||||||
|
MarginLeft=8,
|
||||||
|
StartPoint = new Point(1, 1),
|
||||||
|
EndPoint = new Point(14, 13),
|
||||||
|
StrokeStyle = "2",
|
||||||
|
IsAntiAlias=true,
|
||||||
|
},
|
||||||
|
new Line
|
||||||
|
{
|
||||||
|
MarginTop=10,
|
||||||
|
MarginLeft=8,
|
||||||
|
StartPoint = new Point(14, 1),
|
||||||
|
EndPoint = new Point(1, 13),
|
||||||
|
StrokeStyle = "2",
|
||||||
|
IsAntiAlias=true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}.Assign(out var thumb),
|
||||||
|
new Panel
|
||||||
|
{
|
||||||
|
Attacheds = { { Grid.RowIndex,1 } },
|
||||||
|
BorderFill = "186,210,234",
|
||||||
|
BorderType = BorderType.BorderThickness,
|
||||||
|
BorderThickness = new Thickness(5,0,5,5),
|
||||||
|
Size = SizeField.Fill,
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
|
||||||
var caption = frame.Find<Panel>().FirstOrDefault(x => x.Name == "caption");
|
},
|
||||||
caption.Background = "white";
|
},
|
||||||
caption.BorderType = BorderType.BorderThickness;
|
}
|
||||||
caption.BorderThickness = new Thickness(0, 0, 0, 1);
|
});
|
||||||
caption.BorderFill = "235,235,235";
|
thumb.DragDelta += Thumb_DragDelta;
|
||||||
|
}
|
||||||
|
|
||||||
var title = frame.Find<TextBlock>().FirstOrDefault(x => x.Name == "title");
|
private void Thumb_DragDelta(object sender, DragDeltaEventArgs e)
|
||||||
title.Foreground = "black";
|
{
|
||||||
|
if (this.WindowState == WindowState.Maximized)
|
||||||
frame.ControlBoxStroke = "black";
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.MarginLeft += e.HorizontalChange;
|
||||||
|
this.MarginTop += e.VerticalChange;
|
||||||
|
this.normalPos = new Point(this.MarginLeft.Value, this.MarginTop.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnPropertyChanged(string propertyName, object oldValue, object newValue, PropertyMetadataAttribute propertyMetadata)
|
protected override void OnPropertyChanged(string propertyName, object oldValue, object newValue, PropertyMetadataAttribute propertyMetadata)
|
||||||
@ -56,36 +259,66 @@ namespace CPF.Toolkit.Controls
|
|||||||
switch (propertyName)
|
switch (propertyName)
|
||||||
{
|
{
|
||||||
case nameof(WindowState):
|
case nameof(WindowState):
|
||||||
switch (this.WindowState)
|
|
||||||
{
|
{
|
||||||
case WindowState.Normal:
|
switch (this.WindowState)
|
||||||
{
|
|
||||||
this.Size = this.normalSize;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case WindowState.Minimized:
|
|
||||||
break;
|
|
||||||
case WindowState.Maximized:
|
|
||||||
{
|
|
||||||
this.Size = SizeField.Fill;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case WindowState.FullScreen:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case nameof(Width):
|
|
||||||
case nameof(Height):
|
|
||||||
case nameof(Size):
|
|
||||||
{
|
|
||||||
if (WindowState == WindowState.Normal)
|
|
||||||
{
|
{
|
||||||
this.Size = this.normalSize;
|
case WindowState.Normal:
|
||||||
|
this.Size = this.normalSize;
|
||||||
|
this.MarginLeft = this.normalPos.X;
|
||||||
|
this.MarginTop = this.normalPos.Y;
|
||||||
|
break;
|
||||||
|
case WindowState.Minimized:
|
||||||
|
break;
|
||||||
|
case WindowState.Maximized:
|
||||||
|
this.Size = SizeField.Fill;
|
||||||
|
this.MarginLeft = 0;
|
||||||
|
this.MarginTop = 0;
|
||||||
|
break;
|
||||||
|
case WindowState.FullScreen:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case nameof(Size):
|
||||||
|
case nameof(Width):
|
||||||
|
case nameof(Height):
|
||||||
|
if (this.WindowState == WindowState.Normal)
|
||||||
|
{
|
||||||
|
this.normalSize = this.Size;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nameof(MarginLeft):
|
||||||
|
{
|
||||||
|
if (this.MarginLeft.Value <= 0)
|
||||||
|
{
|
||||||
|
this.MarginLeft = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var value = this.MarginLeft.Value + this.Width.Value;
|
||||||
|
Debug.WriteLine(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case nameof(MarginTop):
|
||||||
|
if (MarginTop.Value <= 0)
|
||||||
|
{
|
||||||
|
this.MarginTop = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//case nameof(MarginRight):
|
||||||
|
// if (MarginRight.Value <= 0)
|
||||||
|
// {
|
||||||
|
// this.MarginRight = 0;
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
//case nameof(MarginBottom):
|
||||||
|
|
||||||
|
// break;
|
||||||
}
|
}
|
||||||
|
|
||||||
base.OnPropertyChanged(propertyName, oldValue, newValue, propertyMetadata);
|
base.OnPropertyChanged(propertyName, oldValue, newValue, propertyMetadata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,16 @@ namespace CPF.Controls
|
|||||||
[PropertyMetadata(typeof(ViewFill), "white")]
|
[PropertyMetadata(typeof(ViewFill), "white")]
|
||||||
public ViewFill ControlBoxStroke { get => GetValue<ViewFill>(); set => SetValue(value); }
|
public ViewFill ControlBoxStroke { get => GetValue<ViewFill>(); set => SetValue(value); }
|
||||||
|
|
||||||
|
[PropertyMetadata(typeof(ViewFill), "#1E9FFF")]
|
||||||
|
public ViewFill CaptionBackgrund { get => GetValue<ViewFill>(); set => SetValue(value); }
|
||||||
|
|
||||||
|
[PropertyMetadata(typeof(ViewFill), "white")]
|
||||||
|
public ViewFill CaptionForeground { get => GetValue<ViewFill>(); set => SetValue(value); }
|
||||||
|
|
||||||
|
[PropertyMetadata(typeof(FloatField), "35")]
|
||||||
|
public FloatField CaptionHeight { get => GetValue<FloatField>(); set => SetValue(value); }
|
||||||
|
|
||||||
|
|
||||||
protected override void InitializeComponent()
|
protected override void InitializeComponent()
|
||||||
{
|
{
|
||||||
//ViewFill color = "#fff";
|
//ViewFill color = "#fff";
|
||||||
@ -163,351 +173,354 @@ namespace CPF.Controls
|
|||||||
});
|
});
|
||||||
//标题栏和按钮
|
//标题栏和按钮
|
||||||
grid.Children.Add(
|
grid.Children.Add(
|
||||||
new Panel
|
new Panel
|
||||||
{
|
|
||||||
Name = "caption",
|
|
||||||
Background = "#1E9FFF",
|
|
||||||
Width = "100%",
|
|
||||||
Height = "30",
|
|
||||||
Commands =
|
|
||||||
{
|
{
|
||||||
|
Name = "caption",
|
||||||
|
Width = "100%",
|
||||||
|
Bindings =
|
||||||
{
|
{
|
||||||
nameof(MouseDown),
|
{ nameof(Panel.Background),nameof(this.CaptionBackgrund),this},
|
||||||
nameof(IWindow.DragMove),
|
{ nameof(Panel.Height),nameof(this.CaptionHeight),this},
|
||||||
Window
|
|
||||||
},
|
},
|
||||||
|
Commands =
|
||||||
{
|
{
|
||||||
nameof(DoubleClick),
|
|
||||||
(s,e)=> DoubleClickTitle()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Children =
|
|
||||||
{
|
|
||||||
new StackPanel
|
|
||||||
{
|
|
||||||
Name="titleBox",
|
|
||||||
MarginLeft=0,
|
|
||||||
Orientation= Orientation.Horizontal,
|
|
||||||
Children=
|
|
||||||
{
|
{
|
||||||
new Picture
|
nameof(MouseDown),
|
||||||
{
|
nameof(IWindow.DragMove),
|
||||||
Name="icon",
|
Window
|
||||||
MarginLeft=5,
|
},
|
||||||
Width=20,
|
{
|
||||||
Height=20,
|
nameof(DoubleClick),
|
||||||
Stretch= Stretch.Fill,
|
(s,e)=> DoubleClickTitle()
|
||||||
Bindings=
|
|
||||||
{
|
|
||||||
{
|
|
||||||
nameof(Picture.Source),
|
|
||||||
nameof(window.Icon),
|
|
||||||
window
|
|
||||||
},
|
|
||||||
{
|
|
||||||
nameof(Visibility),
|
|
||||||
nameof(window.Icon),
|
|
||||||
window,
|
|
||||||
BindingMode.OneWay,
|
|
||||||
a=>a==null||!ShowIcon?Visibility.Collapsed:Visibility.Visible
|
|
||||||
},
|
|
||||||
{
|
|
||||||
nameof(Visibility),
|
|
||||||
nameof(ShowIcon),
|
|
||||||
this,
|
|
||||||
BindingMode.OneWay,
|
|
||||||
(bool showIcon)=>!showIcon||window.Icon==null?Visibility.Collapsed:Visibility.Visible
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new TextBlock
|
|
||||||
{
|
|
||||||
Name="title",
|
|
||||||
MarginLeft=8,
|
|
||||||
MarginTop=2,
|
|
||||||
Bindings=
|
|
||||||
{
|
|
||||||
{
|
|
||||||
nameof(TextBlock.Text),
|
|
||||||
nameof(IWindow.Title),
|
|
||||||
Window
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Foreground="#fff"
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new StackPanel
|
Children =
|
||||||
{
|
{
|
||||||
Name="controlBox",
|
new StackPanel
|
||||||
MarginRight=0,
|
|
||||||
Height = "100%",
|
|
||||||
Orientation= Orientation.Horizontal,
|
|
||||||
Children =
|
|
||||||
{
|
{
|
||||||
systemButtons,
|
Name="titleBox",
|
||||||
new SystemButton
|
MarginLeft=0,
|
||||||
|
Orientation= Orientation.Horizontal,
|
||||||
|
Children=
|
||||||
{
|
{
|
||||||
ToolTip="最小化",
|
new Picture
|
||||||
Name="min",
|
|
||||||
Width = 30,
|
|
||||||
Height = "100%",
|
|
||||||
Content=
|
|
||||||
new Line
|
|
||||||
{
|
{
|
||||||
MarginLeft="auto",
|
Name="icon",
|
||||||
MarginTop=5,
|
MarginLeft=5,
|
||||||
StartPoint = new Point(1, 13),
|
Width=20,
|
||||||
EndPoint = new Point(14, 13),
|
Height=20,
|
||||||
StrokeStyle = "2",
|
Stretch= Stretch.Fill,
|
||||||
IsAntiAlias=true,
|
Bindings=
|
||||||
//StrokeFill=color
|
|
||||||
Bindings =
|
|
||||||
{
|
{
|
||||||
{ nameof(Line.StrokeFill),nameof(this.ControlBoxStroke),this}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Bindings=
|
|
||||||
{
|
|
||||||
{
|
|
||||||
nameof(Visibility),
|
|
||||||
nameof(MinimizeBox),
|
|
||||||
this,
|
|
||||||
BindingMode.OneWay,
|
|
||||||
a=>(bool)a?Visibility.Visible: Visibility.Collapsed
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Commands =
|
|
||||||
{
|
|
||||||
{
|
|
||||||
nameof(Button.Click),
|
|
||||||
(s,e)=>
|
|
||||||
{
|
{
|
||||||
//(e as MouseButtonEventArgs).Handled = true;
|
nameof(Picture.Source),
|
||||||
Window.WindowState = WindowState.Minimized;
|
nameof(window.Icon),
|
||||||
|
window
|
||||||
|
},
|
||||||
|
{
|
||||||
|
nameof(Visibility),
|
||||||
|
nameof(window.Icon),
|
||||||
|
window,
|
||||||
|
BindingMode.OneWay,
|
||||||
|
a=>a==null||!ShowIcon?Visibility.Collapsed:Visibility.Visible
|
||||||
|
},
|
||||||
|
{
|
||||||
|
nameof(Visibility),
|
||||||
|
nameof(ShowIcon),
|
||||||
|
this,
|
||||||
|
BindingMode.OneWay,
|
||||||
|
(bool showIcon)=>!showIcon||window.Icon==null?Visibility.Collapsed:Visibility.Visible
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Triggers=
|
new TextBlock
|
||||||
{
|
{
|
||||||
new Trigger(nameof(Panel.IsMouseOver), Relation.Me)
|
Name="title",
|
||||||
|
MarginLeft=8,
|
||||||
|
MarginTop=2,
|
||||||
|
Bindings=
|
||||||
{
|
{
|
||||||
Setters =
|
|
||||||
{
|
{
|
||||||
{
|
nameof(TextBlock.Text),
|
||||||
nameof(Panel.Background),
|
nameof(IWindow.Title),
|
||||||
hoverColor
|
Window
|
||||||
}
|
},
|
||||||
}
|
{ nameof(TextBlock.Foreground),nameof(this.CaptionForeground),this }
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
,
|
},
|
||||||
new Panel
|
new StackPanel
|
||||||
|
{
|
||||||
|
Name="controlBox",
|
||||||
|
MarginRight=0,
|
||||||
|
Height = "100%",
|
||||||
|
Orientation= Orientation.Horizontal,
|
||||||
|
Children =
|
||||||
{
|
{
|
||||||
Height = "100%",
|
systemButtons,
|
||||||
Bindings=
|
new SystemButton
|
||||||
{
|
{
|
||||||
|
ToolTip="最小化",
|
||||||
|
Name="min",
|
||||||
|
Width = 30,
|
||||||
|
Height = "100%",
|
||||||
|
Content=
|
||||||
|
new Line
|
||||||
{
|
{
|
||||||
nameof(Visibility),
|
MarginLeft="auto",
|
||||||
nameof(MaximizeBox),
|
MarginTop=5,
|
||||||
this,
|
StartPoint = new Point(1, 13),
|
||||||
BindingMode.OneWay,
|
EndPoint = new Point(14, 13),
|
||||||
a=>(bool)a?Visibility.Visible: Visibility.Collapsed
|
StrokeStyle = "2",
|
||||||
}
|
IsAntiAlias=true,
|
||||||
},
|
//StrokeFill=color
|
||||||
Children=
|
Bindings =
|
||||||
{
|
|
||||||
new SystemButton
|
|
||||||
{
|
|
||||||
ToolTip="最大化",
|
|
||||||
Name="max",
|
|
||||||
Width = 30,
|
|
||||||
Height = "100%",
|
|
||||||
Content= new Rectangle
|
|
||||||
{
|
{
|
||||||
Width=14,
|
{ nameof(Line.StrokeFill),nameof(this.ControlBoxStroke),this}
|
||||||
Height=12,
|
}
|
||||||
MarginTop=10,
|
},
|
||||||
StrokeStyle="2",
|
Bindings=
|
||||||
|
{
|
||||||
|
{
|
||||||
|
nameof(Visibility),
|
||||||
|
nameof(MinimizeBox),
|
||||||
|
this,
|
||||||
|
BindingMode.OneWay,
|
||||||
|
a=>(bool)a?Visibility.Visible: Visibility.Collapsed
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Commands =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
nameof(Button.Click),
|
||||||
|
(s,e)=>
|
||||||
|
{
|
||||||
|
//(e as MouseButtonEventArgs).Handled = true;
|
||||||
|
Window.WindowState = WindowState.Minimized;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Triggers=
|
||||||
|
{
|
||||||
|
new Trigger(nameof(Panel.IsMouseOver), Relation.Me)
|
||||||
|
{
|
||||||
|
Setters =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
nameof(Panel.Background),
|
||||||
|
hoverColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
,
|
||||||
|
new Panel
|
||||||
|
{
|
||||||
|
Height = "100%",
|
||||||
|
Bindings=
|
||||||
|
{
|
||||||
|
{
|
||||||
|
nameof(Visibility),
|
||||||
|
nameof(MaximizeBox),
|
||||||
|
this,
|
||||||
|
BindingMode.OneWay,
|
||||||
|
a=>(bool)a?Visibility.Visible: Visibility.Collapsed
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Children=
|
||||||
|
{
|
||||||
|
new SystemButton
|
||||||
|
{
|
||||||
|
ToolTip="最大化",
|
||||||
|
Name="max",
|
||||||
|
Width = 30,
|
||||||
|
Height = "100%",
|
||||||
|
Content= new Rectangle
|
||||||
|
{
|
||||||
|
Width=14,
|
||||||
|
Height=12,
|
||||||
|
MarginTop=10,
|
||||||
|
StrokeStyle="2",
|
||||||
|
Bindings =
|
||||||
|
{
|
||||||
|
{ nameof(Line.StrokeFill),nameof(this.ControlBoxStroke),this}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Commands =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
nameof(Button.Click),
|
||||||
|
(s,e)=>
|
||||||
|
{
|
||||||
|
//(e as MouseButtonEventArgs).Handled = true;
|
||||||
|
Window.WindowState= WindowState.Maximized;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
Bindings =
|
Bindings =
|
||||||
{
|
{
|
||||||
{ nameof(Line.StrokeFill),nameof(this.ControlBoxStroke),this}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Commands =
|
|
||||||
{
|
|
||||||
{
|
|
||||||
nameof(Button.Click),
|
|
||||||
(s,e)=>
|
|
||||||
{
|
{
|
||||||
//(e as MouseButtonEventArgs).Handled = true;
|
nameof(Border.Visibility),
|
||||||
Window.WindowState= WindowState.Maximized;
|
nameof(Window.WindowState),
|
||||||
|
Window,
|
||||||
|
BindingMode.OneWay,
|
||||||
|
a => (WindowState)a == WindowState.Maximized||(WindowState)a == WindowState.FullScreen ? Visibility.Collapsed : Visibility.Visible
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
Triggers=
|
||||||
Bindings =
|
|
||||||
{
|
|
||||||
{
|
{
|
||||||
nameof(Border.Visibility),
|
new Trigger(nameof(Panel.IsMouseOver), Relation.Me)
|
||||||
nameof(Window.WindowState),
|
|
||||||
Window,
|
|
||||||
BindingMode.OneWay,
|
|
||||||
a => (WindowState)a == WindowState.Maximized||(WindowState)a == WindowState.FullScreen ? Visibility.Collapsed : Visibility.Visible
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Triggers=
|
|
||||||
{
|
|
||||||
new Trigger(nameof(Panel.IsMouseOver), Relation.Me)
|
|
||||||
{
|
|
||||||
Setters =
|
|
||||||
{
|
{
|
||||||
|
Setters =
|
||||||
{
|
{
|
||||||
nameof(Panel.Background),
|
{
|
||||||
hoverColor
|
nameof(Panel.Background),
|
||||||
|
hoverColor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
},
|
new SystemButton
|
||||||
new SystemButton
|
{
|
||||||
{
|
ToolTip="向下还原",
|
||||||
ToolTip="向下还原",
|
Name="nor",
|
||||||
Name="nor",
|
Width = 30,
|
||||||
Width = 30,
|
Height = "100%",
|
||||||
Height = "100%",
|
Content=new Panel{
|
||||||
Content=new Panel{
|
Size=SizeField.Fill,
|
||||||
Size=SizeField.Fill,
|
Children=
|
||||||
Children=
|
|
||||||
{
|
|
||||||
new Rectangle
|
|
||||||
{
|
{
|
||||||
MarginTop=15,
|
new Rectangle
|
||||||
MarginLeft=8,
|
|
||||||
Width=11,
|
|
||||||
Height=8,
|
|
||||||
StrokeStyle="1.5",
|
|
||||||
//StrokeFill = color
|
|
||||||
Bindings = { { nameof(Line.StrokeFill), nameof(this.ControlBoxStroke), this } },
|
|
||||||
},
|
|
||||||
new Polyline
|
|
||||||
{
|
|
||||||
MarginTop=11,
|
|
||||||
MarginLeft=12,
|
|
||||||
Points=
|
|
||||||
{
|
{
|
||||||
new Point(0,3),
|
MarginTop=15,
|
||||||
new Point(0,0),
|
MarginLeft=8,
|
||||||
new Point(9,0),
|
Width=11,
|
||||||
new Point(9,7),
|
Height=8,
|
||||||
new Point(6,7)
|
StrokeStyle="1.5",
|
||||||
|
//StrokeFill = color
|
||||||
|
Bindings = { { nameof(Line.StrokeFill), nameof(this.ControlBoxStroke), this } },
|
||||||
},
|
},
|
||||||
//StrokeFill = color,
|
new Polyline
|
||||||
Bindings = { { nameof(Line.StrokeFill), nameof(this.ControlBoxStroke), this } },
|
|
||||||
StrokeStyle="2"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Commands =
|
|
||||||
{
|
|
||||||
{
|
|
||||||
nameof(Button.Click),
|
|
||||||
(s,e)=>
|
|
||||||
{
|
|
||||||
//(e as MouseButtonEventArgs).Handled = true;
|
|
||||||
Window.WindowState = WindowState.Normal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Bindings =
|
|
||||||
{
|
|
||||||
{
|
|
||||||
nameof(Border.Visibility),
|
|
||||||
nameof(Window.WindowState),
|
|
||||||
Window,
|
|
||||||
BindingMode.OneWay,
|
|
||||||
a => (WindowState)a == WindowState.Normal ? Visibility.Collapsed : Visibility.Visible
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Triggers=
|
|
||||||
{
|
|
||||||
new Trigger(nameof(Panel.IsMouseOver), Relation.Me)
|
|
||||||
{
|
|
||||||
Setters =
|
|
||||||
{
|
|
||||||
{
|
{
|
||||||
nameof(Panel.Background),
|
MarginTop=11,
|
||||||
hoverColor
|
MarginLeft=12,
|
||||||
|
Points=
|
||||||
|
{
|
||||||
|
new Point(0,3),
|
||||||
|
new Point(0,0),
|
||||||
|
new Point(9,0),
|
||||||
|
new Point(9,7),
|
||||||
|
new Point(6,7)
|
||||||
|
},
|
||||||
|
//StrokeFill = color,
|
||||||
|
Bindings = { { nameof(Line.StrokeFill), nameof(this.ControlBoxStroke), this } },
|
||||||
|
StrokeStyle="2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
Commands =
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new SystemButton
|
|
||||||
{
|
|
||||||
Name="close",
|
|
||||||
ToolTip="关闭",
|
|
||||||
Width = 30,
|
|
||||||
Height = "100%",
|
|
||||||
Content=new Panel{
|
|
||||||
Size=SizeField.Fill,
|
|
||||||
Children =
|
|
||||||
{
|
|
||||||
new Line
|
|
||||||
{
|
|
||||||
MarginTop=8,
|
|
||||||
MarginLeft=8,
|
|
||||||
StartPoint = new Point(1, 1),
|
|
||||||
EndPoint = new Point(14, 13),
|
|
||||||
StrokeStyle = "2",
|
|
||||||
IsAntiAlias=true,
|
|
||||||
//StrokeFill=color
|
|
||||||
Bindings = { { nameof(Line.StrokeFill), nameof(this.ControlBoxStroke), this } }
|
|
||||||
},
|
|
||||||
new Line
|
|
||||||
{
|
|
||||||
MarginTop=8,
|
|
||||||
MarginLeft=8,
|
|
||||||
StartPoint = new Point(14, 1),
|
|
||||||
EndPoint = new Point(1, 13),
|
|
||||||
StrokeStyle = "2",
|
|
||||||
IsAntiAlias=true,
|
|
||||||
//StrokeFill=color
|
|
||||||
Bindings = { { nameof(Line.StrokeFill), nameof(this.ControlBoxStroke), this } }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Commands =
|
|
||||||
{
|
|
||||||
{
|
|
||||||
nameof(Button.Click),
|
|
||||||
(s,e)=>
|
|
||||||
{
|
|
||||||
//(e as MouseButtonEventArgs).Handled=true;
|
|
||||||
Window.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Triggers=
|
|
||||||
{
|
|
||||||
new Trigger(nameof(Panel.IsMouseOver), Relation.Me)
|
|
||||||
{
|
|
||||||
Setters =
|
|
||||||
{
|
|
||||||
{
|
{
|
||||||
nameof(Panel.Background),
|
{
|
||||||
hoverColor
|
nameof(Button.Click),
|
||||||
}
|
(s,e)=>
|
||||||
|
{
|
||||||
|
//(e as MouseButtonEventArgs).Handled = true;
|
||||||
|
Window.WindowState = WindowState.Normal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Bindings =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
nameof(Border.Visibility),
|
||||||
|
nameof(Window.WindowState),
|
||||||
|
Window,
|
||||||
|
BindingMode.OneWay,
|
||||||
|
a => (WindowState)a == WindowState.Normal ? Visibility.Collapsed : Visibility.Visible
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Triggers=
|
||||||
|
{
|
||||||
|
new Trigger(nameof(Panel.IsMouseOver), Relation.Me)
|
||||||
|
{
|
||||||
|
Setters =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
nameof(Panel.Background),
|
||||||
|
hoverColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
new SystemButton
|
||||||
|
{
|
||||||
|
Name="close",
|
||||||
|
ToolTip="关闭",
|
||||||
|
Width = 30,
|
||||||
|
Height = "100%",
|
||||||
|
Content=new Panel{
|
||||||
|
Size=SizeField.Fill,
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new Line
|
||||||
|
{
|
||||||
|
MarginTop=8,
|
||||||
|
MarginLeft=8,
|
||||||
|
StartPoint = new Point(1, 1),
|
||||||
|
EndPoint = new Point(14, 13),
|
||||||
|
StrokeStyle = "2",
|
||||||
|
IsAntiAlias=true,
|
||||||
|
//StrokeFill=color
|
||||||
|
Bindings = { { nameof(Line.StrokeFill), nameof(this.ControlBoxStroke), this } }
|
||||||
|
},
|
||||||
|
new Line
|
||||||
|
{
|
||||||
|
MarginTop=8,
|
||||||
|
MarginLeft=8,
|
||||||
|
StartPoint = new Point(14, 1),
|
||||||
|
EndPoint = new Point(1, 13),
|
||||||
|
StrokeStyle = "2",
|
||||||
|
IsAntiAlias=true,
|
||||||
|
//StrokeFill=color
|
||||||
|
Bindings = { { nameof(Line.StrokeFill), nameof(this.ControlBoxStroke), this } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Commands =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
nameof(Button.Click),
|
||||||
|
(s,e)=>
|
||||||
|
{
|
||||||
|
//(e as MouseButtonEventArgs).Handled=true;
|
||||||
|
Window.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Triggers=
|
||||||
|
{
|
||||||
|
new Trigger(nameof(Panel.IsMouseOver), Relation.Me)
|
||||||
|
{
|
||||||
|
Setters =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
nameof(Panel.Background),
|
||||||
|
hoverColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
if (Content != null)
|
if (Content != null)
|
||||||
{
|
{
|
||||||
grid.Children.Add(Content, 0, 1);
|
grid.Children.Add(Content, 0, 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user