c#wpf Multibindings不可用

Luc*_*key 4 c# wpf binding multibinding

我想做的很简单.我有一个窗口,我希望标题绑定到两个不同的属性.每当其中一个属性更改时,都应更新标题.

我先尝试过但没有工作

<Window x:Class="MyNamespace.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="{Binding Path=Clientname} {Binding Path=LoadedConfiguration}" 
Run Code Online (Sandbox Code Playgroud)

那么我在这里这里阅读有关Multibindings的内容.并尝试了它的使用,这实际上也不起作用

<Window x:Class="MyNamespace.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<Window.Title>
    <Multibinding StringFormat="{}{0} + {1}">
        <Binding Path="Clientname" />
        <Binding Path="LoadedConfiguration" />
    </Multibinding>
</Window.Title>
Run Code Online (Sandbox Code Playgroud)

错误是在WPF项目中不支持Multibinding,我认为没有任何意义.

所以,我猜测的是缺少xmlns或缺少.dll.我发现Multibindings在"PresentationFramework.dll"里面,我已经引用了它.根据msdn,你需要http://schemas.microsoft.com/winfx/2006/xaml/presentationhttp://schemas.microsoft.com/netfx/2007/xaml/presentation来包含,我做了.

在这里,我可能实际上没有得到任何进一步,我希望你得到.

dym*_*oid 11

使用MultiBinding,而不是Multibinding.XAML区分大小写.

  • 不敢相信这解决了我的问题,有趣的* MultiBinding *在Intellisense中仍然无法选择,就像* TextBlock *之类的其他类一样。-无论如何**非常感谢** (2认同)