一个优化奇怪的 WrapPanel

本文经原作者授权以原创方式二次分享,欢迎转载、分享。

一个优化奇怪的 WrapPanel

作者:陈-林-赵-魏

原文链接[1]:https://www.cnblogs.com/wandia/p/17092221.html

  • FixToRB 附加属性,固定到【右边(水平模式)|底边(垂直模式)】,这将会导致换行。

  • IsFillHorizontal 依赖属性 是否充满。

  • DoubleGreaterThan 浮点数比较静态方法。

  • MeasureOverride 测量所需元素空间大小。

  • ArrangeOverride 排列元素。

  • UVSize 内部结构体,用于 Orientation 方向上存值及其比较。

1) WrapPanelEx.cs 代码如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;namespace WrapPanelEx.Controls
{/// <summary>    /// WrapPanel改进后,增加了填充式布局,转载请保留博客地址!/// 来源:https://www.cnblogs.com/wandia/p/17092221.html/// 作者:陈-林-赵-魏/// WrapPanel改进,增加了设置元素宽度高度时候填充式铺满/// 代码改自 Microsoft WrapPanel 源码/// </summary>public class WrapPanelEx : WrapPanel{#region 附加属性,固定到【右边(水平模式)|底边(垂直模式)】,这将会导致换行public static readonly DependencyProperty FixToRBProperty = DependencyProperty.RegisterAttached("FixToRB",typeof(bool),typeof(WrapPanelEx),new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));public static void SetFixToRB(UIElement element, bool value){element.SetValue(FixToRBProperty, value);}public static bool GetIsFixToRB(UIElement element){return (bool)element.GetValue(FixToRBProperty);}#endregion#region 依赖属性 是否充满public bool IsFillHorizontal{get { return (bool)GetValue(IsFillHorizontalProperty); }set { SetValue(IsFillHorizontalProperty, value); }}public static readonly DependencyProperty IsFillHorizontalProperty =DependencyProperty.Register("IsFillHorizontal", typeof(bool), typeof(WrapPanelEx),new UIPropertyMetadata(false, OnIsFill_ProperthChanged));public bool IsFillVertical{get { return (bool)GetValue(IsFillVerticalProperty); }set { SetValue(IsFillVerticalProperty, value); }}public static readonly DependencyProperty IsFillVerticalProperty = DependencyProperty.Register("IsFillVertical", typeof(bool), typeof(WrapPanelEx),new UIPropertyMetadata(false, OnIsFill_ProperthChanged));private static void OnIsFill_ProperthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e){WrapPanelEx fill = d as WrapPanelEx;if (fill != null) fill.InvalidateMeasure();}#endregion#region 浮点数比较静态方法private const double DBL_EPSILON = 2.2204460492503131e-016; /* smallest such that 1.0+DBL_EPSILON != 1.0 *///计算2个浮点数是否接近private static bool DoubleAreClose(double value1, double value2){//in case they are Infinities (then epsilon check does not work)if (value1 == value2){return true;}// This computes (|value1-value2| / (|value1| + |value2| + 10.0)) < DBL_EPSILONdouble eps = (Math.Abs(value1) + Math.Abs(value2) + 10.0) * DBL_EPSILON;double delta = value1 - value2;return -eps < delta && eps > delta;}private static bool DoubleGreaterThan(double value1, double value2){return value1 > value2 && !DoubleAreClose(value1, value2);}#endregion#region 测量所需元素空间大小/// <summary>///     <see cref="FrameworkElement.MeasureOverride" />/// </summary>protected override Size MeasureOverride(Size availbleSize){   //设否元素宽的设置,是否元素高度设置bool isItemWidthSet = !double.IsNaN(this.ItemWidth) && this.ItemWidth > 0;bool isItemHeightSet = !double.IsNaN(this.ItemHeight) && this.ItemHeight > 0;//非FixToRB=True元素使用测量需求空间SizeSize childConstraint = new Size((isItemWidthSet ? this.ItemWidth : availbleSize.Width),(isItemHeightSet ? this.ItemHeight : availbleSize.Height));//FixToRB=True元素使用测量需求空间SizeSize childFixConstraint = new Size(availbleSize.Width, availbleSize.Height);if (Orientation == Orientation.Horizontal && isItemHeightSet){childFixConstraint.Height = this.ItemHeight;}if (Orientation == Orientation.Vertical && isItemWidthSet){childConstraint.Width = this.ItemWidth;}//这个给非空间测量大小UVSize ItemSetSize = new UVSize(this.Orientation,(isItemWidthSet ? this.ItemWidth : 0),(isItemHeightSet ? this.ItemHeight : 0));//给定的空间大小测量UvSize,用于没有ItemWidth和ItemHeight时候测量元素空间大小, FixToRB=True的元素也使用这个UVSize uvConstraint = new UVSize(Orientation, availbleSize.Width, availbleSize.Height);UVSize curLineSize = new UVSize(Orientation);           //将元素按照水平/垂直排列的方式得出同一行/列所需的空间需求UVSize desireResultSize = new UVSize(Orientation);      //计算处此WrapPanelEx所需的空间大小需求结果UIElementCollection children = InternalChildren;        //拿到内部元素,用于遍历for (int i = 0, count = children.Count; i < count; i++){UIElement child = children[i];          //此元素/当前元素if (child == null) continue;UVSize sz = new UVSize();if (WrapPanelEx.GetIsFixToRB(child) == true){   //此元素需要设置到固定靠右/底的型为操作,测量元素大小时需要放开child.Measure(childFixConstraint);sz = new UVSize(Orientation, child.DesiredSize.Width, child.DesiredSize.Height);//主要是我对与这个固定住的元素的需求宽度高度按照那个标准有点头疼,干脆放开用最大控件算了if (sz.U > 0 && ItemSetSize.U > 0){if (sz.U < ItemSetSize.U){   //保持比例sz.U = ItemSetSize.U;}else{   //设置了同方向中元素的长度,所以这里要按照比例//double lengthCount = Math.Ceiling(sz.U / ItemSetSize.U);//sz.U = lengthCount * ItemSetSize.U;sz.U = Math.Min(sz.U, uvConstraint.U);//这里防止意外}}if (sz.V > 0 && ItemSetSize.V > 0 && sz.V < ItemSetSize.V){   //设置了崔志方向元素长度,如果此元素空间需求小于,则按照ItemSetSize.Vsz.V = ItemSetSize.V;}if (DoubleGreaterThan(curLineSize.U + sz.U, uvConstraint.U)){   //当前同一 列/行 如果容纳 此元素空间将超出desireResultSize.U = Math.Max(curLineSize.U, desireResultSize.U);   //取Orientation方向最大长度desireResultSize.V += curLineSize.V;                                //累加垂直Orientation方向的长度curLineSize = sz;//当前元素需要启1个新行desireResultSize.U = Math.Max(curLineSize.U, desireResultSize.U);   //取Orientation方向最大长度desireResultSize.V += curLineSize.V;                                //累加垂直Orientation方向的长度}else{   //这里是元素空间足够 填充式布局curLineSize.U += sz.U;curLineSize.V = Math.Max(sz.V, curLineSize.V);desireResultSize.U = Math.Max(curLineSize.U, desireResultSize.U);   //取Orientation方向最大长度desireResultSize.V += curLineSize.V;                                //累加垂直Orientation方向的长度}//下一个可能是换行元素....curLineSize = new UVSize(Orientation);                                  //用于存放全新1行}else{child.Measure(childConstraint); //如果设置元素宽度或高度, 其高度宽度尽可能按照设置值给定sz = new UVSize(Orientation,(isItemWidthSet ? this.ItemWidth : child.DesiredSize.Width),(isItemHeightSet ? this.ItemHeight : child.DesiredSize.Height));if (DoubleGreaterThan(curLineSize.U + sz.U, uvConstraint.U)){    //当前同一 列/行 如果容纳 此元素空间将超出desireResultSize.U = Math.Max(curLineSize.U, desireResultSize.U); //取Orientation方向最大长度desireResultSize.V += curLineSize.V;                              //累加垂直Orientation方向的长度curLineSize = sz;                                   //当前行宽度if (DoubleGreaterThan(sz.U, uvConstraint.U)){   //此元素同Orientation方向长度大于给定约束长度,则当前元素为一行desireResultSize.U = Math.Max(sz.U, desireResultSize.U);desireResultSize.V += sz.V;curLineSize = new UVSize(Orientation);  //用于存放全新1行狂赌}}else{   //当前同一 列/行 元素空间足够,可以容纳当前元素curLineSize.U += sz.U;curLineSize.V = Math.Max(sz.V, curLineSize.V);}}}//the last line size, if any should be added  因为超出才累计,最后1行不超出,需要重新添加desireResultSize.U = Math.Max(curLineSize.U, desireResultSize.U);desireResultSize.V += curLineSize.V;//go from UV space to W/H space               将UV值转换成 高度/宽度值return new Size(desireResultSize.Width, desireResultSize.Height);}#endregion#region 排列元素/*var count = Math.Floor(constraint.Width / this.ItemWidth);  //元素个数var averageWidth = constraint.Width / Math.Max(count, 1);   //平均宽度childConstraint.Width = Math.Max(averageWidth, this.ItemWidth);*//// <summary>///     <see cref="FrameworkElement.ArrangeOverride" />/// </summary>protected override Size ArrangeOverride(Size finalSize){//设否元素宽的设置,是否元素高度设置bool isItemWidthSet = !double.IsNaN(this.ItemWidth) && this.ItemWidth > 0;bool isItemHeightSet = !double.IsNaN(this.ItemHeight) && this.ItemHeight > 0;//这个给非空间测量大小UVSize ItemSetSize = new UVSize(this.Orientation,(isItemWidthSet ? this.ItemWidth : 0),(isItemHeightSet ? this.ItemHeight : 0));//给定的空间大小测量UvSize,用于没有ItemWidth和ItemHeight时候测量元素空间大小, FixToRB=True的元素也使用这个UVSize uvConstraint = new UVSize(Orientation, finalSize.Width, finalSize.Height);//用于存放同一方向的元素列/行 集合List<UVCollection> lineUiCollection = new List<UVCollection>();#region 得到同一方向元素集合的集合//if (lineUiCollection != null)   //写一个If只是用于减少外层变量,反感的请将if注释{//当前元素集合行/列UVCollection curLineUis = new UVCollection(this.Orientation, ItemSetSize);//遍历内部元素UIElementCollection children = InternalChildren;        //拿到内部元素,用于遍历for (int i = 0, count = children.Count; i < count; i++){UIElement child = children[i];               //此元素/当前元素if (child == null || child.Visibility == Visibility.Collapsed) continue;UVSize sz = new UVSize();if (WrapPanelEx.GetIsFixToRB(child) == true){   //此元素需要设置到固定靠右/底的型为操作,测量元素大小时需要放开sz = new UVSize(Orientation, child.DesiredSize.Width, child.DesiredSize.Height);double lengthCount = 1;if (sz.U > 0 && ItemSetSize.U > 0){if (sz.U < ItemSetSize.U){   //保持比例sz.U = ItemSetSize.U;}else{   //设置了同方向中元素的长度,所以这里要按照比例lengthCount = Math.Ceiling(sz.U / ItemSetSize.U);//sz.U = lengthCount * ItemSetSize.U;sz.U = Math.Min(sz.U, uvConstraint.U);}}if (sz.V > 0 && ItemSetSize.V > 0 && sz.V < ItemSetSize.V){   //设置了崔志方向元素长度,如果此元素空间需求小于,则按照ItemSetSize.Vsz.V = ItemSetSize.V;}if (DoubleGreaterThan(curLineUis.TotalU + sz.U, uvConstraint.U)){   //当前同一 列/行 如果容纳 此元素空间将超出if (curLineUis.Count > 0){lineUiCollection.Add(curLineUis);}curLineUis = new UVCollection(Orientation, ItemSetSize);curLineUis.Add(child, sz, Convert.ToInt32(lengthCount));}else{   //这里是元素空间足够curLineUis.Add(child, sz, Convert.ToInt32(lengthCount));}lineUiCollection.Add(curLineUis);//下一个可能是换行元素....不管了以后闲得蛋疼再弄吧curLineUis = new UVCollection(Orientation, ItemSetSize);}else{sz = new UVSize(Orientation,(isItemWidthSet ? this.ItemWidth : child.DesiredSize.Width),(isItemHeightSet ? this.ItemHeight : child.DesiredSize.Height));if (DoubleGreaterThan(curLineUis.TotalU + sz.U, uvConstraint.U)){    //当前同一 列/行 如果容纳 此元素空间将超出if (curLineUis.Count > 0){lineUiCollection.Add(curLineUis);}curLineUis = new UVCollection(Orientation, ItemSetSize);curLineUis.Add(child, sz);if (DoubleGreaterThan(sz.U, uvConstraint.U)){lineUiCollection.Add(curLineUis);curLineUis = new UVCollection(Orientation, ItemSetSize);}}else{   //空间足够curLineUis.Add(child, sz);}}}if (curLineUis.Count > 0 && !lineUiCollection.Contains(curLineUis)){lineUiCollection.Add(curLineUis);}}#endregionbool isFillU = false;bool isFillV = false;switch (this.Orientation){case Orientation.Horizontal:isFillU = this.IsFillHorizontal;isFillV = this.IsFillVertical;break;case Orientation.Vertical:isFillU = this.IsFillVertical;isFillV = this.IsFillHorizontal;break;}if (lineUiCollection.Count > 0){double accumulatedV = 0;double adaptULength = 0;bool isAdaptV = false;double adaptVLength = 0;if (isFillU == true){if (ItemSetSize.U > 0){int maxElementCount = lineUiCollection.Max(uiSet => uiSet.UiCollection.Sum(p => p.Value.ULengthCount));adaptULength = (uvConstraint.U - maxElementCount * ItemSetSize.U) / maxElementCount;adaptULength = Math.Max(adaptULength, 0);}}if (isFillV == true){if (ItemSetSize.V > 0){isAdaptV = true;adaptVLength = uvConstraint.V / lineUiCollection.Count;}}bool isHorizontal = (Orientation == Orientation.Horizontal);foreach (UVCollection lineUvCollection in lineUiCollection){double u = 0;List<UIElement> lineUiEles = lineUvCollection.UiCollection.Keys.ToList();double linevV = isAdaptV ? adaptVLength : lineUvCollection.LineV;for (int i = 0; i < lineUiEles.Count; i++){UIElement child = lineUiEles[i];UVLengthSize childSize = lineUvCollection.UiCollection[child];double layoutSlotU = childSize.UVSize.U + childSize.ULengthCount * adaptULength;double layoutSlotV = isAdaptV ? linevV : childSize.UVSize.V;if (WrapPanelEx.GetIsFixToRB(child) == false){child.Arrange(new Rect((isHorizontal ? u : accumulatedV),(isHorizontal ? accumulatedV : u),(isHorizontal ? layoutSlotU : layoutSlotV),(isHorizontal ? layoutSlotV : layoutSlotU)));}else{if (ItemSetSize.U > 0){   //说明同方向有宽度设置,这里尽量按照ItemULength保持layoutSlotU = childSize.ULengthCount * ItemSetSize.U + childSize.ULengthCount * adaptULength;double leaveULength = uvConstraint.U - u;layoutSlotU = Math.Min(leaveULength, layoutSlotU);}child.Arrange(new Rect((isHorizontal ? Math.Max(0, (uvConstraint.U - layoutSlotU)) : accumulatedV),(isHorizontal ? accumulatedV : Math.Max(0, (uvConstraint.U - layoutSlotU))),(isHorizontal ? layoutSlotU : layoutSlotV),(isHorizontal ? layoutSlotV : layoutSlotU)));}u += layoutSlotU;}accumulatedV += linevV;lineUiEles.Clear();}}lineUiCollection.ForEach(col => col.Dispose());lineUiCollection.Clear();return finalSize;}#endregion#region 内部结构体,用于 Orientation 方向上存值及其比较 private struct UVSize{internal UVSize(Orientation orientation, double width, double height){U = V = 0d;_orientation = orientation;Width = width;Height = height;}internal UVSize(Orientation orientation){U = V = 0d;_orientation = orientation;}internal double U;      //同一排序方向上的值internal double V;      //垂直方向上的值private Orientation _orientation;internal double Width{get { return (_orientation == Orientation.Horizontal ? U : V); }set { if (_orientation == Orientation.Horizontal) U = value; else V = value; }}internal double Height{get { return (_orientation == Orientation.Horizontal ? V : U); }set { if (_orientation == Orientation.Horizontal) V = value; else U = value; }}}private class UVLengthSize{public UVSize UVSize { get; set; }public int ULengthCount { get; set; }public UVLengthSize(UVSize uvSize, int uLengthCount){this.UVSize = uvSize;this.ULengthCount = uLengthCount;}}/// <summary>/// 用于存放同一行/列的元素/// </summary>private class UVCollection : IDisposable{public Dictionary<UIElement, UVLengthSize> UiCollection { get; private set; }private UVSize LineDesireUvSize;private UVSize ItemSetSize;public UVCollection(Orientation orientation, UVSize ItemSetSize){this.UiCollection = new Dictionary<UIElement, UVLengthSize>();LineDesireUvSize = new UVSize(orientation);this.ItemSetSize = ItemSetSize;}public double TotalU{get{return LineDesireUvSize.U;}}//垂直方向长度public double LineV{get{return LineDesireUvSize.V;}}public void Add(UIElement element, UVSize childSize, int itemULength = 1){if (this.UiCollection.ContainsKey(element))throw new InvalidOperationException("元素已存在,不可重复添加");this.UiCollection[element] = new UVLengthSize(childSize, itemULength);LineDesireUvSize.U += childSize.U;LineDesireUvSize.V = Math.Max(LineDesireUvSize.V, childSize.V);}public int Count{get{return this.UiCollection.Count;}}public void Dispose(){if (this.UiCollection != null){this.UiCollection.Clear();}this.UiCollection = null;}}#endregion}
}

2) MainWindow.xaml 代码如下:

<wd:Window x:Class="WrapPanelEx.Demo.MainWindow"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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"xmlns:local="clr-namespace:WrapPanelEx.Demo"xmlns:Controls="clr-namespace:WrapPanelEx.Controls"mc:Ignorable="d"Title="陈-林-赵-魏 WrapPanelEx" Height="350" Width="525"><Window.Resources><Style TargetType="TextBlock"><Setter Property="Foreground" Value="Black"/></Style></Window.Resources><Grid Margin="4"><DockPanel><TextBlock Text="一个优化奇怪的WrapPanel" DockPanel.Dock="Top" FontWeight="Bold"/><StackPanel DockPanel.Dock="Top" Orientation="Horizontal"><TextBlock Text="排列方式" VerticalAlignment="Center"/><ComboBox x:Name="CmbOrientation" Width="90" SelectedIndex="1"><Orientation>Vertical</Orientation><Orientation>Horizontal</Orientation></ComboBox><TextBlock Text="水平滚动条" VerticalAlignment="Center"/><ComboBox x:Name="ScrollViewHVisb" Width="90" SelectedIndex="0"><ScrollBarVisibility>Auto</ScrollBarVisibility><ScrollBarVisibility>Disabled</ScrollBarVisibility><ScrollBarVisibility>Hidden</ScrollBarVisibility><ScrollBarVisibility>Visible</ScrollBarVisibility></ComboBox><TextBlock Text="垂直滚动条" VerticalAlignment="Center"/><ComboBox x:Name="ScrollViewVVisb" Width="90" SelectedIndex="0"><ScrollBarVisibility>Auto</ScrollBarVisibility><ScrollBarVisibility>Disabled</ScrollBarVisibility><ScrollBarVisibility>Hidden</ScrollBarVisibility><ScrollBarVisibility>Visible</ScrollBarVisibility></ComboBox></StackPanel><StackPanel DockPanel.Dock="Top" Orientation="Horizontal"><CheckBox x:Name="chkFillWidth" IsChecked="True" Content="水平平铺" VerticalAlignment="Center" VerticalContentAlignment="Center"Margin="0,0,10,0"/><TextBlock Text="宽度" VerticalAlignment="Center"/><Grid><Rectangle x:Name="Rect1" Width="Auto" Visibility="Collapsed"/><TextBox x:Name="txtItemWidth" MinWidth="60" VerticalContentAlignment="Center"Text="{Binding ElementName=Rect1,Path=Width,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/></Grid><CheckBox x:Name="chkFillHeight" IsChecked="True" Content="垂直平铺" VerticalAlignment="Center" VerticalContentAlignment="Center"Margin="0,0,10,0"/><TextBlock Text="高度" VerticalAlignment="Center"/><Grid><TextBox x:Name="txtItemHeight" MinWidth="60" VerticalContentAlignment="Center"Text="{Binding ElementName=Rect1,Path=Height,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/></Grid><TextBlock Text="* 数字可填入NaN" Foreground="Red" VerticalAlignment="Center"/></StackPanel><TabControl><TabItem Header="平铺Demo"><TabControl><TabItem Header="情景1(高度充满)"><Controls:WrapPanelEx x:Name="WrapPanelFill"  Grid.Row="3"IsFillHorizontal="{Binding ElementName=chkFillWidth,Path=IsChecked,Mode=TwoWay}"IsFillVertical="{Binding ElementName=chkFillHeight,Path=IsChecked,Mode=TwoWay}"ItemWidth="{Binding ElementName=Rect1,Path=Width}"  ItemHeight="{Binding ElementName=Rect1,Path=Height}" Orientation="{Binding ElementName=CmbOrientation,Path=SelectedValue}" ><DockPanel MinHeight="35" Margin="0,0,5,2"><DockPanel.Background><LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"><GradientStop Color="#FFA6A6A6" Offset="0"/><GradientStop Color="#FFCFCFCF" Offset="1"/></LinearGradientBrush></DockPanel.Background><Rectangle Fill="#F05033" Width="4"/><Grid Margin="5"><Ellipse StrokeThickness="2" Width="25" Height="25" Stroke="Black"/><Ellipse StrokeThickness="2" Width="17" Height="17" Fill="#FFB8B2B2" /></Grid><TextBlock Text="Changed" FontWeight="Medium" FontSize="16" VerticalAlignment="Center"/></DockPanel><DockPanel MinHeight="35"  Margin="0,0,5,2"><DockPanel.Background><LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"><GradientStop Color="#FFA6A6A6" Offset="0"/><GradientStop Color="#FFCFCFCF" Offset="1"/></LinearGradientBrush></DockPanel.Background><Rectangle Fill="#F05033" Width="4"/><Grid Margin="5" ><Ellipse StrokeThickness="2" Width="25" Height="25" Stroke="Black"/><Ellipse StrokeThickness="2" Width="17" Height="17" Fill="#FFDCA1A1" /></Grid><TextBlock Text="Branches" FontWeight="Medium" FontSize="16" VerticalAlignment="Center"/></DockPanel><DockPanel MinHeight="35"  Margin="0,0,5,2"><DockPanel.Background><LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"><GradientStop Color="#FFA6A6A6" Offset="0"/><GradientStop Color="#FFCFCFCF" Offset="1"/></LinearGradientBrush></DockPanel.Background><Rectangle Fill="#FF3333F0" Width="4"/><Grid Margin="5" ><Ellipse StrokeThickness="2" Width="25" Height="25" Stroke="Black"/><Ellipse StrokeThickness="2" Width="17" Height="17" Fill="#FFB5B9BD" /></Grid><TextBlock Text="Sync" FontWeight="Medium" FontSize="16" VerticalAlignment="Center"/></DockPanel><DockPanel MinHeight="35"  Margin="0,0,5,2"><DockPanel.Background><LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"><GradientStop Color="#FFA6A6A6" Offset="0"/><GradientStop Color="#FFCFCFCF" Offset="1"/></LinearGradientBrush></DockPanel.Background><Rectangle Fill="#FF616161" Width="4"/><Grid Margin="5" ><Ellipse StrokeThickness="2" Width="25" Height="25" Stroke="Black"/><Ellipse StrokeThickness="2" Width="17" Height="17" Fill="#FF3E3E3E" /></Grid><TextBlock Text="Setting" FontWeight="Medium" FontSize="16" VerticalAlignment="Center"/></DockPanel><DockPanel MinHeight="35"  Margin="0,0,5,2"><DockPanel.Background><LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"><GradientStop Color="#FFA6A6A6" Offset="0"/><GradientStop Color="#FF555E85" Offset="1"/></LinearGradientBrush></DockPanel.Background><Rectangle Fill="#FF616161" Width="4"/><Grid Margin="5" ><Ellipse StrokeThickness="2" Width="25" Height="25" Stroke="Black"/><Ellipse StrokeThickness="2" Width="17" Height="17" Fill="#FF93B6AA" /></Grid><TextBlock Text="Others" FontWeight="Medium" FontSize="16" VerticalAlignment="Center"/></DockPanel></Controls:WrapPanelEx></TabItem><TabItem Header="情景2(高度Auto)"><Grid><Grid.RowDefinitions><RowDefinition Height="auto"/><RowDefinition/></Grid.RowDefinitions><Controls:WrapPanelEx IsFillHorizontal="{Binding ElementName=chkFillWidth,Path=IsChecked,Mode=TwoWay}"IsFillVertical="{Binding ElementName=chkFillHeight,Path=IsChecked,Mode=TwoWay}"ItemWidth="{Binding ElementName=Rect1,Path=Width}"  ItemHeight="{Binding ElementName=Rect1,Path=Height}" Orientation="{Binding ElementName=CmbOrientation,Path=SelectedValue}"><DockPanel MinHeight="35" Margin="0,0,5,2"><DockPanel.Background><LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"><GradientStop Color="#FFA6A6A6" Offset="0"/><GradientStop Color="#FFCFCFCF" Offset="1"/></LinearGradientBrush></DockPanel.Background><Rectangle Fill="#F05033" Width="4"/><Grid Margin="5"><Ellipse StrokeThickness="2" Width="25" Height="25" Stroke="Black"/><Ellipse StrokeThickness="2" Width="17" Height="17" Fill="#FFB8B2B2" /></Grid><TextBlock Text="Changed" FontWeight="Medium" FontSize="16" VerticalAlignment="Center"/></DockPanel><DockPanel MinHeight="35"  Margin="0,0,5,2"><DockPanel.Background><LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"><GradientStop Color="#FFA6A6A6" Offset="0"/><GradientStop Color="#FFCFCFCF" Offset="1"/></LinearGradientBrush></DockPanel.Background><Rectangle Fill="#F05033" Width="4"/><Grid Margin="5" ><Ellipse StrokeThickness="2" Width="25" Height="25" Stroke="Black"/><Ellipse StrokeThickness="2" Width="17" Height="17" Fill="#FFDCA1A1" /></Grid><TextBlock Text="Branches" FontWeight="Medium" FontSize="16" VerticalAlignment="Center"/></DockPanel><DockPanel MinHeight="35"  Margin="0,0,5,2"><DockPanel.Background><LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"><GradientStop Color="#FFA6A6A6" Offset="0"/><GradientStop Color="#FFCFCFCF" Offset="1"/></LinearGradientBrush></DockPanel.Background><Rectangle Fill="#FF3333F0" Width="4"/><Grid Margin="5" ><Ellipse StrokeThickness="2" Width="25" Height="25" Stroke="Black"/><Ellipse StrokeThickness="2" Width="17" Height="17" Fill="#FFB5B9BD" /></Grid><TextBlock Text="Sync" FontWeight="Medium" FontSize="16" VerticalAlignment="Center"/></DockPanel><DockPanel MinHeight="35"  Margin="0,0,5,2"><DockPanel.Background><LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"><GradientStop Color="#FFA6A6A6" Offset="0"/><GradientStop Color="#FFCFCFCF" Offset="1"/></LinearGradientBrush></DockPanel.Background><Rectangle Fill="#FF616161" Width="4"/><Grid Margin="5" ><Ellipse StrokeThickness="2" Width="25" Height="25" Stroke="Black"/><Ellipse StrokeThickness="2" Width="17" Height="17" Fill="#FF3E3E3E" /></Grid><TextBlock Text="Setting" FontWeight="Medium" FontSize="16" VerticalAlignment="Center"/></DockPanel><DockPanel MinHeight="35"  Margin="0,0,5,2"><DockPanel.Background><LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"><GradientStop Color="#FFA6A6A6" Offset="0"/><GradientStop Color="#FF555E85" Offset="1"/></LinearGradientBrush></DockPanel.Background><Rectangle Fill="#FF616161" Width="4"/><Grid Margin="5" ><Ellipse StrokeThickness="2" Width="25" Height="25" Stroke="Black"/><Ellipse StrokeThickness="2" Width="17" Height="17" Fill="#FF93B6AA" /></Grid><TextBlock Text="Others" FontWeight="Medium" FontSize="16" VerticalAlignment="Center"/></DockPanel></Controls:WrapPanelEx><Border Grid.Row="1" BorderThickness="1" BorderBrush="Red" Margin="0,4" Visibility="Visible"><Label Content="这里是VS扩展git源码提交部分界面不实现!"/></Border></Grid></TabItem><TabItem Header="情景3(ScrollView中表现)"><Border  Grid.Row="3" Margin="70,30" BorderBrush="Red" BorderThickness="1"><ScrollViewer HorizontalScrollBarVisibility="{Binding ElementName=ScrollViewHVisb,Path=SelectedValue}"VerticalScrollBarVisibility="{Binding ElementName=ScrollViewVVisb,Path=SelectedValue}"><Controls:WrapPanelEx x:Name="WrapPanelFill3" IsFillHorizontal="{Binding ElementName=chkFillWidth,Path=IsChecked,Mode=TwoWay}"IsFillVertical="{Binding ElementName=chkFillHeight,Path=IsChecked,Mode=TwoWay}"ItemWidth="{Binding ElementName=Rect1,Path=Width}"  ItemHeight="{Binding ElementName=Rect1,Path=Height}" Orientation="{Binding ElementName=CmbOrientation,Path=SelectedValue}"><DockPanel MinHeight="35" Margin="0,0,5,2"><DockPanel.Background><LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"><GradientStop Color="#FFA6A6A6" Offset="0"/><GradientStop Color="#FFCFCFCF" Offset="1"/></LinearGradientBrush></DockPanel.Background><Rectangle Fill="#F05033" Width="4"/><Grid Margin="5"><Ellipse StrokeThickness="2" Width="25" Height="25" Stroke="Black"/><Ellipse StrokeThickness="2" Width="17" Height="17" Fill="#FFB8B2B2" /></Grid><TextBlock Text="Changed" FontWeight="Medium" FontSize="16" VerticalAlignment="Center"/></DockPanel><DockPanel MinHeight="35"  Margin="0,0,5,2"><DockPanel.Background><LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"><GradientStop Color="#FFA6A6A6" Offset="0"/><GradientStop Color="#FFCFCFCF" Offset="1"/></LinearGradientBrush></DockPanel.Background><Rectangle Fill="#F05033" Width="4"/><Grid Margin="5" ><Ellipse StrokeThickness="2" Width="25" Height="25" Stroke="Black"/><Ellipse StrokeThickness="2" Width="17" Height="17" Fill="#FFDCA1A1" /></Grid><TextBlock Text="Branches" FontWeight="Medium" FontSize="16" VerticalAlignment="Center"/></DockPanel><DockPanel MinHeight="35"  Margin="0,0,5,2"><DockPanel.Background><LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"><GradientStop Color="#FFA6A6A6" Offset="0"/><GradientStop Color="#FFCFCFCF" Offset="1"/></LinearGradientBrush></DockPanel.Background><Rectangle Fill="#FF3333F0" Width="4"/><Grid Margin="5" ><Ellipse StrokeThickness="2" Width="25" Height="25" Stroke="Black"/><Ellipse StrokeThickness="2" Width="17" Height="17" Fill="#FFB5B9BD" /></Grid><TextBlock Text="Sync" FontWeight="Medium" FontSize="16" VerticalAlignment="Center"/></DockPanel><DockPanel MinHeight="35"  Margin="0,0,5,2"><DockPanel.Background><LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"><GradientStop Color="#FFA6A6A6" Offset="0"/><GradientStop Color="#FFCFCFCF" Offset="1"/></LinearGradientBrush></DockPanel.Background><Rectangle Fill="#FF616161" Width="4"/><Grid Margin="5" ><Ellipse StrokeThickness="2" Width="25" Height="25" Stroke="Black"/><Ellipse StrokeThickness="2" Width="17" Height="17" Fill="#FF3E3E3E" /></Grid><TextBlock Text="Setting" FontWeight="Medium" FontSize="16" VerticalAlignment="Center"/></DockPanel><DockPanel MinHeight="35"  Margin="0,0,5,2"><DockPanel.Background><LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"><GradientStop Color="#FFA6A6A6" Offset="0"/><GradientStop Color="#FF555E85" Offset="1"/></LinearGradientBrush></DockPanel.Background><Rectangle Fill="#FF616161" Width="4"/><Grid Margin="5" ><Ellipse StrokeThickness="2" Width="25" Height="25" Stroke="Black"/><Ellipse StrokeThickness="2" Width="17" Height="17" Fill="#FF93B6AA" /></Grid><TextBlock Text="Others" FontWeight="Medium" FontSize="16" VerticalAlignment="Center"/></DockPanel></Controls:WrapPanelEx></ScrollViewer></Border></TabItem></TabControl></TabItem><TabItem Header="平铺+靠右"><DockPanel><StackPanel  DockPanel.Dock="Top" Orientation="Horizontal"><TextBlock Text="输入控件宽度" VerticalAlignment="Center"/><Grid><Rectangle x:Name="Rect2" Visibility="Collapsed"/><TextBox MinWidth="60"  VerticalContentAlignment="Center"Text="{Binding ElementName=Rect2,Path=Width,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/></Grid><TextBlock Text="输入控件高度" VerticalAlignment="Center"/><Grid><TextBox MinWidth="60" VerticalContentAlignment="Center"Text="{Binding ElementName=Rect2,Path=Height,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/></Grid><ComboBox x:Name="cmbVerAlig" SelectedIndex="3" Width="70"><VerticalAlignment>Top</VerticalAlignment><VerticalAlignment>Center</VerticalAlignment><VerticalAlignment>Bottom</VerticalAlignment><VerticalAlignment>Stretch</VerticalAlignment></ComboBox><ComboBox x:Name="cmbHorAlig" SelectedIndex="3" Width="70"><HorizontalAlignment>Left</HorizontalAlignment><HorizontalAlignment>Center</HorizontalAlignment><HorizontalAlignment>Right</HorizontalAlignment><HorizontalAlignment>Stretch</HorizontalAlignment></ComboBox></StackPanel><TabControl><TabItem Header="一个"><UniformGrid x:Name="UnifornGrid1" Rows="1" ><ScrollViewer HorizontalScrollBarVisibility="{Binding ElementName=ScrollViewHVisb,Path=SelectedValue}"VerticalScrollBarVisibility="{Binding ElementName=ScrollViewVVisb,Path=SelectedValue}"><DockPanel><Label Content="WrapPanel" Background="#FFCBCBEA" DockPanel.Dock="Top" /><WrapPanel  ItemWidth="{Binding ElementName=Rect1,Path=Width}"  ItemHeight="{Binding ElementName=Rect1,Path=Height}" Orientation="{Binding ElementName=CmbOrientation,Path=SelectedValue}"><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容1" VerticalAlignment="Center"/><TextBox /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容2" VerticalAlignment="Center"/><TextBox /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容3" VerticalAlignment="Center"/><TextBox /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容4" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容5" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容6" VerticalAlignment="Center"/><TextBox  /></DockPanel><UniformGrid  Rows="1" Margin="5,0"  MinWidth="200"Controls:WrapPanelEx.FixToRB="True"HorizontalAlignment="{Binding ElementName=cmbHorAlig,Path=SelectedValue}"VerticalAlignment="{Binding ElementName=cmbVerAlig,Path=SelectedValue}"><Button Content="查询"    MinHeight="22"  Margin="1"/><Button Content="导出"  MinHeight="22"  Margin="1"/></UniformGrid></WrapPanel></DockPanel></ScrollViewer><ScrollViewer HorizontalScrollBarVisibility="{Binding ElementName=ScrollViewHVisb,Path=SelectedValue}"VerticalScrollBarVisibility="{Binding ElementName=ScrollViewVVisb,Path=SelectedValue}"><DockPanel><Label Content="WrapPanelFill" Background="#FFB4F1AA" DockPanel.Dock="Top" /><Controls:WrapPanelEx IsFillHorizontal="{Binding ElementName=chkFillWidth,Path=IsChecked,Mode=TwoWay}"IsFillVertical="{Binding ElementName=chkFillHeight,Path=IsChecked,Mode=TwoWay}"ItemWidth="{Binding ElementName=Rect1,Path=Width}"  ItemHeight="{Binding ElementName=Rect1,Path=Height}" Orientation="{Binding ElementName=CmbOrientation,Path=SelectedValue}"><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容1" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容2" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容3" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容4" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容5" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容6" VerticalAlignment="Center"/><TextBox  /></DockPanel><UniformGrid  Rows="1" Margin="5,0"  MinWidth="200"Controls:WrapPanelEx.FixToRB="True"HorizontalAlignment="{Binding ElementName=cmbHorAlig,Path=SelectedValue}"VerticalAlignment="{Binding ElementName=cmbVerAlig,Path=SelectedValue}"><Button Content="查询"    MinHeight="22"  Margin="1"/><Button Content="导出"  MinHeight="22"  Margin="1"/></UniformGrid></Controls:WrapPanelEx></DockPanel></ScrollViewer></UniformGrid></TabItem><TabItem Header="多个"><UniformGrid x:Name="UnifornGrid2" Rows="1" ><ScrollViewer HorizontalScrollBarVisibility="{Binding ElementName=ScrollViewHVisb,Path=SelectedValue}"VerticalScrollBarVisibility="{Binding ElementName=ScrollViewVVisb,Path=SelectedValue}"><DockPanel><Label Content="WrapPanel" Background="#FFCBCBEA" DockPanel.Dock="Top" /><WrapPanel  ItemWidth="{Binding ElementName=Rect1,Path=Width}"  ItemHeight="{Binding ElementName=Rect1,Path=Height}" Orientation="{Binding ElementName=CmbOrientation,Path=SelectedValue}"><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容1" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容2" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容3" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容4" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容5" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容6" VerticalAlignment="Center"/><TextBox  /></DockPanel><UniformGrid  Rows="1" Margin="5,0"  MinWidth="200"Controls:WrapPanelEx.FixToRB="True"HorizontalAlignment="{Binding ElementName=cmbHorAlig,Path=SelectedValue}"VerticalAlignment="{Binding ElementName=cmbVerAlig,Path=SelectedValue}"><Button Content="查询"    MinHeight="22"  Margin="1"/><Button Content="导出"  MinHeight="22"  Margin="1"/></UniformGrid><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容1" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容2" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容3" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容4" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容5" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容6" VerticalAlignment="Center"/><TextBox  /></DockPanel><UniformGrid  Rows="1" Margin="5,0"  MinWidth="200"Controls:WrapPanelEx.FixToRB="True"HorizontalAlignment="{Binding ElementName=cmbHorAlig,Path=SelectedValue}"VerticalAlignment="{Binding ElementName=cmbVerAlig,Path=SelectedValue}"><Button Content="查询"    MinHeight="22"  Margin="1"/><Button Content="导出"  MinHeight="22"  Margin="1"/></UniformGrid></WrapPanel></DockPanel></ScrollViewer><ScrollViewer HorizontalScrollBarVisibility="{Binding ElementName=ScrollViewHVisb,Path=SelectedValue}"VerticalScrollBarVisibility="{Binding ElementName=ScrollViewVVisb,Path=SelectedValue}"><DockPanel><Label Content="WrapPanelFill" Background="#FFB4F1AA" DockPanel.Dock="Top" /><Controls:WrapPanelEx IsFillHorizontal="{Binding ElementName=chkFillWidth,Path=IsChecked,Mode=TwoWay}"IsFillVertical="{Binding ElementName=chkFillHeight,Path=IsChecked,Mode=TwoWay}"ItemWidth="{Binding ElementName=Rect1,Path=Width}"  ItemHeight="{Binding ElementName=Rect1,Path=Height}" Orientation="{Binding ElementName=CmbOrientation,Path=SelectedValue}"><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容1" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容2" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容3" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容4" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容5" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容6" VerticalAlignment="Center"/><TextBox  /></DockPanel><UniformGrid  Rows="1" Margin="5,0"  MinWidth="200"Controls:WrapPanelEx.FixToRB="True"HorizontalAlignment="{Binding ElementName=cmbHorAlig,Path=SelectedValue}"VerticalAlignment="{Binding ElementName=cmbVerAlig,Path=SelectedValue}"><Button Content="查询"    MinHeight="22"  Margin="1"/><Button Content="导出"  MinHeight="22"  Margin="1"/></UniformGrid><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容1" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容2" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容3" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容4" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容5" VerticalAlignment="Center"/><TextBox  /></DockPanel><DockPanel Margin="0,2" Width="{Binding ElementName=Rect2,Path=Width}"Height="{Binding ElementName=Rect2,Path=Height}"><TextBlock Text="内容6" VerticalAlignment="Center"/><TextBox  /></DockPanel><UniformGrid  Rows="1" Margin="5,0"  MinWidth="200"Controls:WrapPanelEx.FixToRB="True"HorizontalAlignment="{Binding ElementName=cmbHorAlig,Path=SelectedValue}"VerticalAlignment="{Binding ElementName=cmbVerAlig,Path=SelectedValue}"><Button Content="查询"    MinHeight="22"  Margin="1"/><Button Content="导出"  MinHeight="22"  Margin="1"/></UniformGrid></Controls:WrapPanelEx></DockPanel></ScrollViewer></UniformGrid></TabItem></TabControl></DockPanel></TabItem></TabControl></DockPanel><Border  HorizontalAlignment="Right" VerticalAlignment="Top" IsHitTestVisible="False" BorderBrush="Blue" Background="#FF56AFFD" Margin="5,5,5,5" BorderThickness="1"TextElement.FontFamily="微软雅黑" TextElement.FontWeight="Thin" Opacity="0.35"TextElement.Foreground="White" Padding="4"><StackPanel><TextBlock Text="WrapPanelEx控件"/><TextBlock Text="IsFillHorizontal属性:有ItemWidth情况下水平平铺"/><TextBlock Text="IsFillVertical属性:有ItemHeight情况下水平平铺"/><TextBlock Text="WrapPanelEx.FixToRB:水平排列元素时则向右对齐换行"/><TextBlock TextAlignment="Right" Text="垂直排列元素时则向底部对齐换行" /></StackPanel></Border></Grid>
</wd:Window>

参考资料

[1]

原文链接: https://www.cnblogs.com/wandia/p/17092221.html

一个优化奇怪的 WrapPanel相关推荐

  1. 发现一个很奇怪的现象,MyBaits 的 insert方法一直返回-2147482646

    点击关注公众号,Java干货及时送达来源:cnblogs.com/wyq178/p/8652443.html 前几天在做项目demo的时候,发现有一个很奇怪的现象: 就是MyBatis发现更新和插入返 ...

  2. QT中关于头文件一个很奇怪的问题

    最近在用QT Creator时候遇上一个很奇怪的问题,以往添加头文件使用#include<QStringListModel>这样的格式就可以,但是现在有时候却编译通不过,报了一大堆的错误, ...

  3. 一个很奇怪的 OpenCV出错:resize的坑

    简 介: 在cv2.resize中会存在很多"坑".但对象的数据格式不是"float"造成出错,给出的提示非常具有迷惑性.注意这一点会使得后面的编程更加的愉快. ...

  4. 直播 | 同源共流:一个优化框架统一与解释图神经网络

    「AI Drive」是由 PaperWeekly 和 biendata 共同发起的学术直播间,旨在帮助更多的青年学者宣传其最新科研成果.我们一直认为,单向地输出知识并不是一个最好的方式,而有效地反馈和 ...

  5. 推荐一个优化分页查询的办法(分页数很大的情况)

    通常情况下我们都这样这样取分页数据 SELECT SQL_NO_CACHE * FROM erp_orders ORDER BY id LIMIT 300000,10; 一般情况下,ORM生成的就是这 ...

  6. 七步确定一个优化项目的难易度

    不管是公司还是个人,不管是小项目还是大项目,在接活之前,都要先确定一下项目的优化难易度,项目能不能做,然后才能给客户报出合理的价格,不至于报高把客户吓跑,报低自己吃亏.都是一些接项目的技巧,下边萝卜就 ...

  7. CuteEditor 6.0一个很奇怪的Bug

    将编辑器升级到CuteEditor 6.0后,真 OO无双发现编辑器会产生多余的font标记.我测试后发现,将纯文本粘贴到CuteEditor 6.0后,会产生<font face=" ...

  8. get请求400错误 vue_vue用get请求,一个很奇怪的现象

    页面长这样: 打印出来的是选中的id 点击"确定"后,我向后端发送一个get请求 this.$axios.get('/crossSchool',{ params:{ itemUid ...

  9. php小说网站windows慢,终于找到WORDPRESS网站响应慢的罪魁祸首,你仅仅需要一个优化方案。...

    去年下半年为了提升网站的打开速度--因为速度对于网站关键词排名的稳定性和用户体验都很重要(还包括自己更新文章的热情和心情在内).博主由原来的WINDOWS主机搬至LINUX主机.刚搬迁过来的同时,针对 ...

最新文章

  1. Javascript到PHP加密通讯的简单实现
  2. 基于 GraphQL 实践的一点思考
  3. 速看!高校开学返校的40个最新信息
  4. 关于工业级RS485串口服务器的组网方式详解
  5. 【HTML5】HTML5基础语法汇总
  6. mysql的大字段clob,Oracle数据库导出大字段(CLOB)数据
  7. 12306:春节抢票高峰已过,技术团队为自己打 90 分以上
  8. Cisco交换机设备配置镜像端口
  9. 最新WIN10系统封装教程2019系列(六)——常规软件安装
  10. Tech Talk| Redmi K50 电竞版手机极致散热技术详解
  11. 腾讯校园招聘一面总结
  12. c#winform——Gobang五子棋简易版双人对战制作(基本结构+代码)
  13. 转换uptime_王者荣耀角色转换什么时候正式上线_王者荣耀角色转换上线时间-超分手游网...
  14. 398、Java框架52 -【Hibernate - 分页、两种获取方式】 2020.10.27
  15. 批处理命令之Start的详细用法-P处理打开IE窗口最大化
  16. 阿哲学了就来聊——Java反射
  17. vnc view使用教程
  18. Prometheus监控系统详解
  19. 人大统计专硕432考研专业课经验分享
  20. 字符串方法intern()详解

热门文章

  1. shellexecute 执行完成_shell和ShellExecute的用法
  2. 毛哥的快乐生活(23) 我不装了!我摊牌了!我就是大神
  3. 毕设管理系统java_基于Java的人事管理系统的设计任务书
  4. 临界资源与临界区、互斥与同步、原子性概念介绍
  5. 疑惑,System.currentTimeMillis真有性能问题?
  6. 前端02——HTML排版标签
  7. 【防止恶意用户注册】-- 手机在网状态 API 的防欺诈应用解析
  8. Mac开启root权限
  9. linux 下scp传文件时,报错 not a regular file
  10. Oracle项目管理之Primavera Unifier学习地图(持续更新)