运行Visual 2017并以.NET 4.6.1为目标。考虑下面的XAML。在XAML编辑器中,您可以看到两个循环,但在运行应用程序时,只显示了第二个循环。
<Window x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Window.Resources>
<Viewbox x:Key="MyBox" Stretch="Uniform">
<Ellipse Width="4" Height="4" Fill="Red"/>
</Viewbox>
</Window.Resources>
<StackPanel>
<ContentPresenter Width="100" Content="{StaticResource MyBox}"/>
<ContentPresenter Width="100" Content="{StaticResource MyBox}"/>
</StackPanel>
</Window>如何重用Viewbox资源?
发布于 2018-02-19 10:10:04
将其x:Shared属性设置为false:
<Viewbox x:Key="MyBox" x:Shared="False" Stretch="Uniform">https://stackoverflow.com/questions/48863696
复制相似问题