sportdog

导航

 
  1. 引用   xmlns:sys="clr-namespace:System;assembly=mscorlib"
  2. <Window.Resources>
    <sys:String x:Key="myString">Hello Wpf Resource</sys:String>
    </Window.Resources>

  3. 前台绑定:

    <TextBox Grid.Column="0" Grid.Row="0" x:Name="txtName" Text="{StaticResource ResourceKey=myString}" Grid.ColumnSpan="2"></TextBox>

  4.   后台访问:String str = this.FindResource("myString").ToString();
posted on 2018-03-07 14:15  sportdog  阅读(139)  评论(0编辑  收藏  举报