Wpf XAML+;文本框:引用程序集中包含的资源文件中的文本
我知道如何在XAML中使用程序集资源中的图像作为Wpf XAML+;文本框:引用程序集中包含的资源文件中的文本,wpf,xaml,resources,Wpf,Xaml,Resources,我知道如何在XAML中使用程序集资源中的图像作为图像元素: <Image Source="pack://application:,,,/MyImage.png" /> 这是我当前的解决方案,但需要一些代码: Uri licenseUri = new Uri("pack://application:,,,/MyTextFile.txt", UriKind.Absolute); StreamResourceInfo info = Application.GetResourceStrea
图像
元素:
<Image Source="pack://application:,,,/MyImage.png" />
这是我当前的解决方案,但需要一些代码:
Uri licenseUri = new Uri("pack://application:,,,/MyTextFile.txt", UriKind.Absolute);
StreamResourceInfo info = Application.GetResourceStream(licenseUri);
StreamReader reader = new StreamReader(info.Stream);
_textBox.Text = reader.ReadToEnd();
Uri licenseUri = new Uri("pack://application:,,,/MyTextFile.txt", UriKind.Absolute);
StreamResourceInfo info = Application.GetResourceStream(licenseUri);
StreamReader reader = new StreamReader(info.Stream);
_textBox.Text = reader.ReadToEnd();