namespace MyNamespace
{ ...
public partial class MainPage : ContentPage
{ ...
public const double MyBorderWidth = 3.5;
}
}
<ContentPage ...
xmlns:me="clr-namespace:MyNamespace;assembly=MyApp">
<Button BorderWidth="{x:StaticExtension Member=me:MainPage.MyBorderWidth}" />
...
</ContentPage>
本文探讨了在XAML中如何使用静态资源扩展成员来引用类的常量属性,通过具体的代码示例展示了如何在Button控件中设置BorderWidth属性为类MainPage中的MyBorderWidth常量。
542

被折叠的 条评论
为什么被折叠?



