-
Notifications
You must be signed in to change notification settings - Fork 22
x:Static
L edited this page Dec 30, 2017
·
3 revisions
用途:访问代码中的变量等
后台定义一个变量
public partial class GetStaticFromBackgroundCode : Window
{
public static string Name = "这是来自后台的静态变量";
public GetStaticFromBackgroundCode()
{
InitializeComponent();
}
}
前端访问
<TextBox Text="{x:Static local:GetStaticFromBackgroundCode.Name}"></TextBox>
https://github.com/zLulus/NotePractice/tree/dev3/WPF/WpfDemo/GetStaticFromBackgroundCode