2
我想在我的App.Xaml中为fontsize定义一些资源。WPF从x:static中为double定义一个staticresource
这种类型的事情会工作:
<sys:Double x:Key="FontLarge">24</sys:Double>
但我想从一个值:xStatic所以是这样的:
<sys:Double x:Key="FontLarge">{x:Static local:Settings.FontLarge</sys:Double>
或
<sys:Double x:Key="FontLarge" Value="{x:Static local:Settings.FontLarge"></sys:Double>
无论是这些工作虽然。这是可能的,语法是什么?
您可以在绑定本身中使用x:static,而不是在xaml中定义double。即您打算使用FontLarge的地方,只需使用x:Static local:Settings.FontLarge? –
我可以但我必须改变我的标记中的很多东西。这样做意味着我只需要在一个地方定义它。 –
您是否通过FontSize =“{StaticResource FontLarge}”'静态引用资源,或者将其与FontSize =“{Binding Source = {StaticResource FontLarge}}”'绑定? – Grx70