指定宽度/高度为WPF资源
-
21-09-2019 - |
题
是否有在WPF的方式来指定宽度/高度作为资源,以便它可以以几种样式例如可重复使用余量/填充?
解决方案
不确定
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Page.Resources>
<sys:Double x:Key="Height">200</sys:Double>
<sys:Double x:Key="Width">200</sys:Double>
</Page.Resources>
<Grid>
<Rectangle
Height="{StaticResource Height}"
Width="{StaticResource Width}"
Fill="Blue"/>
</Grid>
</Page>
不隶属于 StackOverflow