WPF在XAML的资源中定义空字符串String.Empty

代码如下:

<!--1. 首先引用System的命名空间-->

    <Window x:Class="DriverEasyWPF.Views.DialogWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib">
      <Window.Resources>

<!--2.正常的定义String类型资源-->

           <sys:Stirng x:Key="str1">test1</sys:String>

    <sys:Stirng x:Key="str1">test1</sys:String>
<!--3.定义空的String类型资源要用x:Static-->
       <x:Static x:Key="empty" Member="sys:String.Empty" />
  </Window.Resources>

  </Windows>

原文地址:https://www.cnblogs.com/tommy-huang/p/5416349.html