mirror of
https://gitee.com/csharpui/CPF.git
synced 2025-06-28 13:34:09 +08:00
简化触发器写法
This commit is contained in:
parent
23289bbf15
commit
4e23e93d9d
@ -20,6 +20,10 @@ namespace CPF.Skia
|
|||||||
SKImage image;
|
SKImage image;
|
||||||
SKPaint paint;
|
SKPaint paint;
|
||||||
GRBackendTexture backendTexture;
|
GRBackendTexture backendTexture;
|
||||||
|
/// <summary>
|
||||||
|
/// 支持OpenGL绘制的控件,在GLRender事件里绘制,开启GPU硬件加速才能使用 new SkiaDrawingFactory { UseGPU = true }
|
||||||
|
/// </summary>
|
||||||
|
public GLView() { }
|
||||||
|
|
||||||
//IGlContext context;
|
//IGlContext context;
|
||||||
protected unsafe override void OnRender(DrawingContext dc)
|
protected unsafe override void OnRender(DrawingContext dc)
|
||||||
|
@ -17,29 +17,54 @@ namespace CPF
|
|||||||
{
|
{
|
||||||
PropertyName = sourceProperty;
|
PropertyName = sourceProperty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BindingDescribe(string sourceProperty, BindingMode binding)
|
public BindingDescribe(string sourceProperty, BindingMode binding)
|
||||||
{
|
{
|
||||||
PropertyName = sourceProperty;
|
PropertyName = sourceProperty;
|
||||||
BindingMode = binding;
|
BindingMode = binding;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置绑定
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source">如果是int或者byte,0是自己,1是Parent,2是Parent.Parent....</param>
|
||||||
|
/// <param name="sourceProperty"></param>
|
||||||
|
/// <param name="binding"></param>
|
||||||
public BindingDescribe(object source, string sourceProperty, BindingMode binding)
|
public BindingDescribe(object source, string sourceProperty, BindingMode binding)
|
||||||
{
|
{
|
||||||
PropertyName = sourceProperty;
|
PropertyName = sourceProperty;
|
||||||
BindingMode = binding;
|
BindingMode = binding;
|
||||||
Source = source;
|
Source = source;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置绑定
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source">如果是int或者byte,0是自己,1是Parent,2是Parent.Parent....</param>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="sourceProperty"></param>
|
||||||
public BindingDescribe(object source, string sourceProperty)
|
public BindingDescribe(object source, string sourceProperty)
|
||||||
{
|
{
|
||||||
PropertyName = sourceProperty;
|
PropertyName = sourceProperty;
|
||||||
Source = source;
|
Source = source;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置绑定
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source">如果是int或者byte,0是自己,1是Parent,2是Parent.Parent....</param>
|
||||||
|
/// <param name="sourceProperty"></param>
|
||||||
|
/// <param name="convert"></param>
|
||||||
public BindingDescribe(object source, string sourceProperty, Func<object, object> convert)
|
public BindingDescribe(object source, string sourceProperty, Func<object, object> convert)
|
||||||
{
|
{
|
||||||
PropertyName = sourceProperty;
|
PropertyName = sourceProperty;
|
||||||
Source = source;
|
Source = source;
|
||||||
Convert = convert;
|
Convert = convert;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置绑定
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source">如果是int或者byte,0是自己,1是Parent,2是Parent.Parent....</param>
|
||||||
|
/// <param name="sourceProperty"></param>
|
||||||
|
/// <param name="binding"></param>
|
||||||
|
/// <param name="convert"></param>
|
||||||
public BindingDescribe(object source, string sourceProperty, BindingMode binding, Func<object, object> convert)
|
public BindingDescribe(object source, string sourceProperty, BindingMode binding, Func<object, object> convert)
|
||||||
{
|
{
|
||||||
BindingMode = binding;
|
BindingMode = binding;
|
||||||
@ -47,6 +72,14 @@ namespace CPF
|
|||||||
Source = source;
|
Source = source;
|
||||||
Convert = convert;
|
Convert = convert;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置绑定
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source">如果是int或者byte,0是自己,1是Parent,2是Parent.Parent....</param>
|
||||||
|
/// <param name="sourceProperty"></param>
|
||||||
|
/// <param name="binding"></param>
|
||||||
|
/// <param name="convert"></param>
|
||||||
|
/// <param name="convertBack"></param>
|
||||||
public BindingDescribe(object source, string sourceProperty, BindingMode binding, Func<object, object> convert, Func<object, object> convertBack)
|
public BindingDescribe(object source, string sourceProperty, BindingMode binding, Func<object, object> convert, Func<object, object> convertBack)
|
||||||
{
|
{
|
||||||
BindingMode = binding;
|
BindingMode = binding;
|
||||||
@ -55,6 +88,16 @@ namespace CPF
|
|||||||
Convert = convert;
|
Convert = convert;
|
||||||
ConvertBack = convertBack;
|
ConvertBack = convertBack;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置绑定
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source">如果是int或者byte,0是自己,1是Parent,2是Parent.Parent....</param>
|
||||||
|
/// <param name="sourceProperty"></param>
|
||||||
|
/// <param name="binding"></param>
|
||||||
|
/// <param name="convert"></param>
|
||||||
|
/// <param name="convertBack"></param>
|
||||||
|
/// <param name="SourceToTargetError"></param>
|
||||||
|
/// <param name="TargetToSourceError"></param>
|
||||||
public BindingDescribe(object source, string sourceProperty, BindingMode binding, Func<object, object> convert, Func<object, object> convertBack, Action<Binding, object, Exception> SourceToTargetError, Action<Binding, object, Exception> TargetToSourceError)
|
public BindingDescribe(object source, string sourceProperty, BindingMode binding, Func<object, object> convert, Func<object, object> convertBack, Action<Binding, object, Exception> SourceToTargetError, Action<Binding, object, Exception> TargetToSourceError)
|
||||||
{
|
{
|
||||||
BindingMode = binding;
|
BindingMode = binding;
|
||||||
@ -81,6 +124,10 @@ namespace CPF
|
|||||||
/// 简化绑定命令的命令,如果设置了该属性,则使用命令绑定
|
/// 简化绑定命令的命令,如果设置了该属性,则使用命令绑定
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public CommandDescribe Command { get; set; }
|
public CommandDescribe Command { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 简化触发器设置
|
||||||
|
/// </summary>
|
||||||
|
public CPF.Styling.TriggerDescribe Trigger { get; set; }
|
||||||
|
|
||||||
//public CpfObject Owner { get; internal set; }
|
//public CpfObject Owner { get; internal set; }
|
||||||
|
|
||||||
@ -355,6 +402,10 @@ namespace CPF
|
|||||||
{
|
{
|
||||||
return new BindingDescribe { Command = command };
|
return new BindingDescribe { Command = command };
|
||||||
}
|
}
|
||||||
|
public static implicit operator BindingDescribe(CPF.Styling.TriggerDescribe trigger)
|
||||||
|
{
|
||||||
|
return new BindingDescribe { Trigger = trigger };
|
||||||
|
}
|
||||||
public static implicit operator BindingDescribe((string sourceProperty, BindingMode binding) item)
|
public static implicit operator BindingDescribe((string sourceProperty, BindingMode binding) item)
|
||||||
{
|
{
|
||||||
return new BindingDescribe { PropertyName = item.sourceProperty, BindingMode = item.binding };
|
return new BindingDescribe { PropertyName = item.sourceProperty, BindingMode = item.binding };
|
||||||
|
@ -10,7 +10,7 @@ namespace CPF.Controls
|
|||||||
/// 内容模板
|
/// 内容模板
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Description("内容模板"), Browsable(false)]
|
[Description("内容模板"), Browsable(false)]
|
||||||
public class ContentTemplate : Decorator
|
public class ContentTemplate : Control
|
||||||
{
|
{
|
||||||
[PropertyMetadata(null)]
|
[PropertyMetadata(null)]
|
||||||
public object Content
|
public object Content
|
||||||
@ -85,9 +85,56 @@ namespace CPF.Controls
|
|||||||
overridePropertys.Override(nameof(Width), new UIPropertyMetadataAttribute(typeof(FloatField), "100%", UIPropertyOptions.AffectsMeasure));
|
overridePropertys.Override(nameof(Width), new UIPropertyMetadataAttribute(typeof(FloatField), "100%", UIPropertyOptions.AffectsMeasure));
|
||||||
overridePropertys.Override(nameof(Height), new UIPropertyMetadataAttribute(typeof(FloatField), "100%", UIPropertyOptions.AffectsMeasure));
|
overridePropertys.Override(nameof(Height), new UIPropertyMetadataAttribute(typeof(FloatField), "100%", UIPropertyOptions.AffectsMeasure));
|
||||||
}
|
}
|
||||||
//protected override Size MeasureOverride(in Size availableSize)
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取或设置 单一子元素。
|
||||||
|
/// </summary>
|
||||||
|
[Browsable(false)]
|
||||||
|
protected UIElement Child
|
||||||
|
{
|
||||||
|
get { return GetValue<UIElement>(); }
|
||||||
|
set { SetValue(value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
[PropertyChanged(nameof(Child))]
|
||||||
|
void OnChild(object newValue, object oldValue, PropertyMetadataAttribute attribute)
|
||||||
|
{
|
||||||
|
var o = oldValue as UIElement;
|
||||||
|
if (o != null)
|
||||||
|
{
|
||||||
|
Children.Remove(o);
|
||||||
|
}
|
||||||
|
var c = newValue as UIElement;
|
||||||
|
if (c != null)
|
||||||
|
{
|
||||||
|
Children.Add(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//protected override void OnPropertyChanged(string propertyName, object oldValue, object newValue, PropertyMetadataAttribute propertyMetadata)
|
||||||
//{
|
//{
|
||||||
// return base.MeasureOverride(availableSize);
|
// base.OnPropertyChanged(propertyName, oldValue, newValue, propertyMetadata);
|
||||||
|
// if (propertyName == nameof(Child))
|
||||||
|
// {
|
||||||
|
// var o = oldValue as UIElement;
|
||||||
|
// if (o != null)
|
||||||
|
// {
|
||||||
|
// Children.Remove(o);
|
||||||
|
// }
|
||||||
|
// var c = newValue as UIElement;
|
||||||
|
// if (c != null)
|
||||||
|
// {
|
||||||
|
// Children.Add(c);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
protected override void OnUIElementRemoved(UIElementRemovedEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnUIElementRemoved(e);
|
||||||
|
if (e.Element == Child)
|
||||||
|
{
|
||||||
|
Child = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,8 +90,11 @@ namespace CPF.Controls
|
|||||||
Name = "contentPresenter",
|
Name = "contentPresenter",
|
||||||
PresenterFor = this
|
PresenterFor = this
|
||||||
});
|
});
|
||||||
Triggers.Add(new Styling.Trigger { Property = nameof(IsMouseOver), PropertyConditions = a => (bool)a && !IsSelected, Setters = { { nameof(Background), "229,243,251" } } });
|
//Triggers.Add(new Styling.Trigger { Property = nameof(IsMouseOver), PropertyConditions = a => (bool)a && !IsSelected, Setters = { { nameof(Background), "229,243,251" } } });
|
||||||
Triggers.Add(new Styling.Trigger { Property = nameof(IsSelected), Setters = { { nameof(Background), "203,233,246" } } });
|
//Triggers.Add(new Styling.Trigger { Property = nameof(IsSelected), Setters = { { nameof(Background), "203,233,246" } } });
|
||||||
|
|
||||||
|
this[nameof(IsMouseOver)] = new Styling.TriggerDescribe(a => (bool)a && !IsSelected, (nameof(Background), "229,243,251"));
|
||||||
|
this[nameof(IsSelected)] = new Styling.TriggerDescribe((nameof(Background), "203,233,246"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -209,12 +209,33 @@ namespace CPF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (value.Trigger != null)
|
||||||
|
{
|
||||||
|
OnAddTriggerDescribe(propertyName, value.Trigger);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Bindings.Add(propertyName, value.PropertyName, value.Source, value.BindingMode, value.Convert, value.ConvertBack, value.SourceToTargetError, value.TargetToSourceError);
|
if (value.Source is int layer)
|
||||||
|
{
|
||||||
|
Bindings.Add(propertyName, value.PropertyName, (byte)layer, value.BindingMode, value.Convert, value.ConvertBack, value.SourceToTargetError, value.TargetToSourceError);
|
||||||
|
}
|
||||||
|
if (value.Source is byte layer1)
|
||||||
|
{
|
||||||
|
Bindings.Add(propertyName, value.PropertyName, layer1, value.BindingMode, value.Convert, value.ConvertBack, value.SourceToTargetError, value.TargetToSourceError);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Bindings.Add(propertyName, value.PropertyName, value.Source, value.BindingMode, value.Convert, value.ConvertBack, value.SourceToTargetError, value.TargetToSourceError);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal protected virtual void OnAddTriggerDescribe(string property, TriggerDescribe trigger)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 读取或者设置附加属性,参数必须是附加属性
|
/// 读取或者设置附加属性,参数必须是附加属性
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -43,8 +43,12 @@ namespace CPF.Styling
|
|||||||
this.PropertyConditions = DefaultPropertyConditions;
|
this.PropertyConditions = DefaultPropertyConditions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
bool DefaultPropertyConditions(object v)
|
/// 属性为true的条件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="v"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool DefaultPropertyConditions(object v)
|
||||||
{
|
{
|
||||||
return (bool)v;
|
return (bool)v;
|
||||||
}
|
}
|
||||||
@ -143,6 +147,110 @@ namespace CPF.Styling
|
|||||||
internal HybridDictionary<CpfObject, List<string>> SetPropertys;
|
internal HybridDictionary<CpfObject, List<string>> SetPropertys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class TriggerDescribe
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 触发器
|
||||||
|
/// </summary>
|
||||||
|
public TriggerDescribe(Relation TargetRelation, Func<object, bool> PropertyConditions, params (string, object)[] propertyAndValues)
|
||||||
|
{
|
||||||
|
this.TargetRelation = TargetRelation;
|
||||||
|
this.PropertyConditions = PropertyConditions;
|
||||||
|
this.Setters = propertyAndValues;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 触发器
|
||||||
|
/// </summary>
|
||||||
|
public TriggerDescribe(params (string, object)[] propertyAndValues)
|
||||||
|
{
|
||||||
|
this.Setters = propertyAndValues;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 触发器
|
||||||
|
/// </summary>
|
||||||
|
public TriggerDescribe(Func<object, bool> PropertyConditions, params (string, object)[] propertyAndValues)
|
||||||
|
{
|
||||||
|
this.PropertyConditions = PropertyConditions;
|
||||||
|
this.Setters = propertyAndValues;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 触发器
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="TargetRelation"></param>
|
||||||
|
/// <param name="PropertyConditions"></param>
|
||||||
|
/// <param name="Animation"></param>
|
||||||
|
/// <param name="AnimationDuration"></param>
|
||||||
|
/// <param name="AnimationIterationCount"></param>
|
||||||
|
/// <param name="AnimationEndBehavior"></param>
|
||||||
|
/// <param name="propertyAndValues"></param>
|
||||||
|
public TriggerDescribe(Relation TargetRelation = null, Func<object, bool> PropertyConditions = default, Storyboard Animation = null, TimeSpan? AnimationDuration = null, uint AnimationIterationCount = 1, EndBehavior AnimationEndBehavior = EndBehavior.Recovery, params (string, object)[] propertyAndValues)
|
||||||
|
{
|
||||||
|
this.TargetRelation = TargetRelation;
|
||||||
|
this.PropertyConditions = PropertyConditions;
|
||||||
|
this.PropertyConditions = PropertyConditions;
|
||||||
|
this.Setters = propertyAndValues;
|
||||||
|
this.Animation = Animation;
|
||||||
|
if (AnimationDuration.HasValue)
|
||||||
|
{
|
||||||
|
this.AnimationDuration = AnimationDuration.Value;
|
||||||
|
}
|
||||||
|
this.AnimationIterationCount = AnimationIterationCount;
|
||||||
|
this.AnimationEndBehavior = AnimationEndBehavior;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 满足条件之后播放的动画
|
||||||
|
/// </summary>
|
||||||
|
public Storyboard Animation { get; set; }
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 条件属性
|
||||||
|
///// </summary>
|
||||||
|
//public string Property { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 属性条件,参数是属性值,返回条件结果
|
||||||
|
/// </summary>
|
||||||
|
public Func<object, bool> PropertyConditions { get; set; }
|
||||||
|
|
||||||
|
public (string, object)[] Setters { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 相对位置元素,用来设置值或者动画
|
||||||
|
/// </summary>
|
||||||
|
public Relation TargetRelation { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 动画持续时间
|
||||||
|
/// </summary>
|
||||||
|
public TimeSpan AnimationDuration
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
} = TimeSpan.FromSeconds(0.5);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 动画播放次数,0为无限循环
|
||||||
|
/// </summary>
|
||||||
|
public uint AnimationIterationCount
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
} = 1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 动画结束之后的行为
|
||||||
|
/// </summary>
|
||||||
|
public EndBehavior AnimationEndBehavior
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
} = EndBehavior.Recovery;
|
||||||
|
}
|
||||||
|
|
||||||
//public enum Conditions
|
//public enum Conditions
|
||||||
//{
|
//{
|
||||||
// NotEqual,
|
// NotEqual,
|
||||||
|
@ -3280,6 +3280,23 @@ namespace CPF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected internal override void OnAddTriggerDescribe(string property, TriggerDescribe trigger)
|
||||||
|
{
|
||||||
|
var t = new Trigger { Animation = trigger.Animation, AnimationDuration = trigger.AnimationDuration, AnimationEndBehavior = trigger.AnimationEndBehavior, AnimationIterationCount = trigger.AnimationIterationCount, PropertyConditions = trigger.PropertyConditions, TargetRelation = trigger.TargetRelation, Property = property };
|
||||||
|
if (trigger.Setters != null && trigger.Setters.Length > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in trigger.Setters)
|
||||||
|
{
|
||||||
|
t.Setters.Add(item.Item1, item.Item2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (t.PropertyConditions == null)
|
||||||
|
{
|
||||||
|
t.PropertyConditions = t.DefaultPropertyConditions;
|
||||||
|
}
|
||||||
|
Triggers.Add(t);
|
||||||
|
}
|
||||||
|
|
||||||
//Styles styles;
|
//Styles styles;
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
|
@ -45,7 +45,7 @@ namespace ConsoleApp1
|
|||||||
#endif
|
#endif
|
||||||
})
|
})
|
||||||
, (OperatingSystemType.OSX, new CPF.Mac.MacPlatform(), new SkiaDrawingFactory { UseGPU = false })
|
, (OperatingSystemType.OSX, new CPF.Mac.MacPlatform(), new SkiaDrawingFactory { UseGPU = false })
|
||||||
, (OperatingSystemType.Linux, new CPF.Linux.LinuxPlatform(), new SkiaDrawingFactory { UseGPU = false })
|
, (OperatingSystemType.Linux, new CPF.Linux.LinuxPlatform(), new SkiaDrawingFactory { UseGPU = true })
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ namespace ConsoleApp1
|
|||||||
},
|
},
|
||||||
new RowDefinition
|
new RowDefinition
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -419,7 +419,7 @@ namespace ConsoleApp1
|
|||||||
},
|
},
|
||||||
new Separator
|
new Separator
|
||||||
{
|
{
|
||||||
|
|
||||||
},
|
},
|
||||||
new MenuItem
|
new MenuItem
|
||||||
{
|
{
|
||||||
@ -429,10 +429,13 @@ namespace ConsoleApp1
|
|||||||
new MenuItem
|
new MenuItem
|
||||||
{
|
{
|
||||||
Header = "21",
|
Header = "21",
|
||||||
Commands =
|
Commands =
|
||||||
{
|
{
|
||||||
{nameof(MenuItem.Click),MenuItemClick }
|
{
|
||||||
}
|
nameof(MenuItem.Click),
|
||||||
|
MenuItemClick
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
new MenuItem
|
new MenuItem
|
||||||
{
|
{
|
||||||
@ -444,7 +447,10 @@ namespace ConsoleApp1
|
|||||||
Header = "221",
|
Header = "221",
|
||||||
Commands =
|
Commands =
|
||||||
{
|
{
|
||||||
{nameof(MenuItem.Click),MenuItemClick }
|
{
|
||||||
|
nameof(MenuItem.Click),
|
||||||
|
MenuItemClick
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new MenuItem
|
new MenuItem
|
||||||
@ -452,7 +458,10 @@ namespace ConsoleApp1
|
|||||||
Header = "222",
|
Header = "222",
|
||||||
Commands =
|
Commands =
|
||||||
{
|
{
|
||||||
{nameof(MenuItem.Click),MenuItemClick }
|
{
|
||||||
|
nameof(MenuItem.Click),
|
||||||
|
MenuItemClick
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -468,10 +477,13 @@ namespace ConsoleApp1
|
|||||||
new MenuItem
|
new MenuItem
|
||||||
{
|
{
|
||||||
Header = "31",
|
Header = "31",
|
||||||
Commands =
|
Commands =
|
||||||
{
|
{
|
||||||
{nameof(MenuItem.Click),MenuItemClick }
|
{
|
||||||
}
|
nameof(MenuItem.Click),
|
||||||
|
MenuItemClick
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
new MenuItem
|
new MenuItem
|
||||||
{
|
{
|
||||||
@ -1362,7 +1374,8 @@ namespace ConsoleApp1
|
|||||||
},
|
},
|
||||||
new ListBox
|
new ListBox
|
||||||
{
|
{
|
||||||
//Background="#aaa",
|
MarginLeft = 57,
|
||||||
|
MarginTop = 63,//Background="#aaa",
|
||||||
Name="listbox",
|
Name="listbox",
|
||||||
IsVirtualizing=true,//VirtualizationMode= VirtualizationMode.Recycling,
|
IsVirtualizing=true,//VirtualizationMode= VirtualizationMode.Recycling,
|
||||||
SelectionMode= SelectionMode.Extended,
|
SelectionMode= SelectionMode.Extended,
|
||||||
@ -1372,7 +1385,18 @@ namespace ConsoleApp1
|
|||||||
{
|
{
|
||||||
Width="100%",
|
Width="100%",
|
||||||
FontSize=22,
|
FontSize=22,
|
||||||
Tag=this,
|
Tag=this,
|
||||||
|
Template=(e,c)=>{
|
||||||
|
c.Add(new Border
|
||||||
|
{
|
||||||
|
Background="#f00",
|
||||||
|
Height = "100%",
|
||||||
|
Width = "100%",
|
||||||
|
BorderFill = null,
|
||||||
|
Name = "contentPresenter",
|
||||||
|
PresenterFor = this
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
Bindings=
|
Bindings=
|
||||||
{
|
{
|
||||||
@ -1398,6 +1422,65 @@ namespace ConsoleApp1
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},//new Button{ Content="排序" },
|
},//new Button{ Content="排序" },
|
||||||
|
new ListBox
|
||||||
|
{
|
||||||
|
MarginLeft = 463,
|
||||||
|
MarginTop = 44,
|
||||||
|
Height = 431,
|
||||||
|
Width = 283,
|
||||||
|
Background = "white",
|
||||||
|
BorderFill = new SolidColorFill
|
||||||
|
{
|
||||||
|
Color = Color.Silver
|
||||||
|
},
|
||||||
|
BorderThickness = new Thickness(0, 1, 0, 0),
|
||||||
|
BorderType = BorderType.BorderThickness,
|
||||||
|
ItemsPanel = new StackPanel
|
||||||
|
{
|
||||||
|
Orientation = Orientation.Horizontal
|
||||||
|
},
|
||||||
|
ItemTemplate = new ListBoxItem
|
||||||
|
{
|
||||||
|
Width = 100,
|
||||||
|
MarginRight = 1,
|
||||||
|
FontSize = 16f,
|
||||||
|
BorderFill = "Silver",
|
||||||
|
BorderThickness = new Thickness(1),
|
||||||
|
Margin = new ThicknessField(1),
|
||||||
|
CornerRadius = new CornerRadius(2),
|
||||||
|
IsAntiAlias = true,
|
||||||
|
UseLayoutRounding = true,
|
||||||
|
BorderType = BorderType.BorderThickness,
|
||||||
|
Template=(e,c)=>{
|
||||||
|
Children.Add(new Border
|
||||||
|
{
|
||||||
|
Background="#f00",
|
||||||
|
Height = "100%",
|
||||||
|
Width = "100%",
|
||||||
|
BorderFill = null,
|
||||||
|
Name = "contentPresenter",
|
||||||
|
PresenterFor = this
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//ContentTemplate = new ContentTemplate
|
||||||
|
//{
|
||||||
|
// Size = SizeField.Fill,
|
||||||
|
// Content = new StackPanel
|
||||||
|
// {
|
||||||
|
// Orientation = Orientation.Horizontal,
|
||||||
|
// Size = SizeField.Fill,
|
||||||
|
// Children =
|
||||||
|
// {
|
||||||
|
// new TextBlock
|
||||||
|
// {
|
||||||
|
// //[nameof(TextBlock.Text)] = new BindingDescribe("Title",BindingMode.OneWay)
|
||||||
|
// Text = "test"
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
//},
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1719,7 +1802,7 @@ namespace ConsoleApp1
|
|||||||
nameof(DragEnter),
|
nameof(DragEnter),
|
||||||
(s,e)=>
|
(s,e)=>
|
||||||
{
|
{
|
||||||
//(e as DragEventArgs).DragEffects= DragDropEffects.Link;
|
//(e as DragEventArgs).DragEffects= DragDropEffects.Link;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -1762,7 +1845,7 @@ namespace ConsoleApp1
|
|||||||
Content="模糊,你撸多了",
|
Content="模糊,你撸多了",
|
||||||
Effect=new BlurEffect
|
Effect=new BlurEffect
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Button
|
new Button
|
||||||
@ -1789,7 +1872,7 @@ namespace ConsoleApp1
|
|||||||
Content="灰色",
|
Content="灰色",
|
||||||
Effect=new GrayScaleEffect
|
Effect=new GrayScaleEffect
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Picture
|
new Picture
|
||||||
@ -1998,7 +2081,7 @@ namespace ConsoleApp1
|
|||||||
{
|
{
|
||||||
new RowDefinition
|
new RowDefinition
|
||||||
{
|
{
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Children =
|
Children =
|
||||||
|
Loading…
Reference in New Issue
Block a user