dev*_*tal 29 wpf resources styles resourcedictionary
在WPF中是否有一种方法可以指定宽度/高度作为资源,以便可以在多种样式中重复使用,例如边距/填充?
Rob*_*ney 55
当然.
<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>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15543 次 |
| 最近记录: |