Wpf 绑定到资源文本文件
我想将文本块绑定到作为资源编译的文本文件。有没有一种方法可以像绑定带有源属性和包uri的图像一样绑定它Wpf 绑定到资源文本文件,wpf,xaml,data-binding,text-files,Wpf,Xaml,Data Binding,Text Files,我想将文本块绑定到作为资源编译的文本文件。有没有一种方法可以像绑定带有源属性和包uri的图像一样绑定它 <Image Source="pack://application:,,,/Properties/..."/> 好吧,你当然不能完全用同样的方法。如果您尝试以下方法: <TextBox Text="pack://application:,,,/Properties/..."/> 来自XAML的用法: <Window x:Class="WPF.MainW
<Image Source="pack://application:,,,/Properties/..."/>
好吧,你当然不能完全用同样的方法。如果您尝试以下方法:
<TextBox Text="pack://application:,,,/Properties/..."/>
来自XAML的用法:
<Window
x:Class="WPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wpf="clr-namespace:WPF">
<TextBlock Text="{wpf:Text 'Assets/Data.txt'}" />
</Window>
当然,假设命名文本文件是一个资源:
进一步阅读:
<Window
x:Class="WPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wpf="clr-namespace:WPF">
<TextBlock Text="{wpf:Text 'Assets/Data.txt'}" />
</Window>