日期:2014-05-18 浏览次数:20827 次
public class ConstValues { const string ColorValue1 = "Red"; const string ColorValue2 = "Green"; } /// <summary> /// Interaction logic for Window1.xaml /// </summary> public partial class Window1 : Window { public Window1() { InitializeComponent(); } }
<Window.Resources> <!--ConstValues资源的声明--> </Window.Resources> <StackPanel> <TextBlock x:Name="TextBlock1"/><!--设置Text属性为资源中相应的内容--> <TextBlock x:Name="TextBlock2"/><!--设置Text属性为资源中相应的内容--> </StackPanel>