是否可以将WrapPanel中所有TextBlocks的宽度调整为WrapPanel中最大TextBlock的大小?最终结果应该是包含"Some data"的控件的宽度与包含"比以前更多的数据"的控件的宽度相同.我已经附上我的初始代码作为起点.我使用字符串作为示例,但集合数据和模板可以是任何东西,所以我不能依赖字符串的长度.
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:System="clr-namespace:System;assembly=mscorlib"
xmlns:Collections="clr-namespace:System.Collections;assembly=mscorlib"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<Collections:ArrayList x:Key="data">
<System:String>Some data</System:String>
<System:String>Some more data</System:String>
<System:String>Even more data than before</System:String>
</Collections:ArrayList>
</Window.Resources>
<ItemsControl ItemsSource="{StaticResource data}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel></WrapPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Margin="5" BorderThickness="1" BorderBrush="Black">
<TextBlock Text="{Binding}"></TextBlock>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Window>
Run Code Online (Sandbox Code Playgroud)
以及所需输出的图像:

使用 ChartJS 2.9.4,为什么这两个图表不同?
<div >
<canvas id="topcanvas"></canvas>
<canvas id="bottomcanvas"></canvas>
</div>
Run Code Online (Sandbox Code Playgroud)
var leftdata = {
labels: [0, 1, 2, 3, 4, 5],
datasets: [{
label: "A",
backgroundColor: 'rgba(0, 0, 255, 0.5)',
data: [12, 19, 3, 5, 1],
xAxisID: "A"
},
{
label: "B",
backgroundColor: 'rgba(0, 255, 0, 0.5)',
data: [14, 19, 6, 2, 4],
xAxisID: "B"
}
]
};
var rightdata = {
labels: [0, 1, 2, 3, "4", 5], // the #4 being a string is the only difference
datasets: …Run Code Online (Sandbox Code Playgroud)