无法让我的转换器工作
我试图让我的转换器工作,但 XAML 不知道它在哪里..但是它位于一个名为 Converters 的文件夹中。
这是我的 XAML 的设置方式...
Fill="{Binding RequestStatus, Converter={StaticResource converters:StatusToColorConverter}}">
在顶部...
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Exemple8.Convertisseurs">
我的转换器...
Public Class StatusToColorConverter
Implements IValueConverter
...
Ive tried to make my converter to work but the XAML doesn't know where it is.. but its there in a folder called Converters.
Here how my XAML are setup...
Fill="{Binding RequestStatus, Converter={StaticResource converters:StatusToColorConverter}}">
At the top...
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Exemple8.Convertisseurs">
My converter...
Public Class StatusToColorConverter
Implements IValueConverter
...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是它的工作原理,
StaticResource
引用添加到控件和对象的Resources
字典中的对象,您需要创建一个实例并通过其键引用它,或者在Binding
中直接创建它。例如
That's not how it works,
StaticResource
references objects added to theResources
dictionary on controls and objects, you need to create an instance and reference it by its key or create it right in theBinding
.e.g.