[英]Margin value type in resources
我想將所有頁面的邊距設置為默認值。 對於我使用的高度
<System:Double x:Key="Height">20</System:Double>
但邊距是 '0,2,0,0' 我必須使用什么類型?
我不想使用樣式和二傳手。
對於Margin
您希望Thickness
屬性設置它,而不是 System:Double try;
<Thickness x:Key="Height" Left="0" Top="2" Right="0" Bottom="0" />
<Button Margin="{StaticResource Height}" Content="Hey I have a Margin now"/>
希望這可以幫助。
試試這種將 Margin 定義為資源的簡化方法。
<Thickness x:Key="MarginCustom1">100</Thickness> <!--Sets L/T/R/B to 100-->
<Thickness x:Key="MarginCustom2">10,20</Thickness> <!--Sets L/R to 10 and T/B to 20 -->
<Thickness x:Key="MarginCustom3">10,10,10,10</Thickness> <!--Sets L/T/R/B respectively-->
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.