开发者

MultiBinding not working but corresponding Binding does work

I have the following code:

<local:StaffAtMeetingEditor DataContext="{Binding Meeting}" Grid.Row="1">
    <local:StaffAtMeetingEditor.InEditMode>
        <MultiBinding Converter="{StaticResource myMeetingLogEditableMultiConverter}">
            <Binding Path="ParentSI.ItemInEditMode"/>
        </MultiBinding>
    </local:StaffAtMeetingEditor.InEditMode>
</local:StaffAtMeetingEditor>
开发者_如何转开发

The setup is that the containing control's datatype is "SIP_ServiceItem". This class has a property called "Meeting" (which is set as the DataContext for the local:StaffAtMeetingEditor control), which itself has a member called "ParentSI", pointing back to the parent SIP_ServiceItem object.

The issue is, that if I pass this through as a single binding (i.e. remove the start and end MultiBinding tags from the code above, leaving just the Binding), it works just fine. But when I make it a MultiBinding (I wish to add some other Bindings to this shortly), and try to pass the bound value through to myMeetingLogEditableMultiConverter, the values(0) parameter, which should correspond to the boolean ParentSI.ItemInEditMode is actually an MS.Internal.NamedObject, implying there's a null reference somewhere. Furthermore, the ParentSI property is never being evaluated, so something is going completely wrong. I am at a loss to know the difference between the single binding and multi binding cases.

Thanks.


I know this is a bit old, and you have likely figured this out by now, but I came across this as I had a similar problem and thought I'd share the solution: I had the same problem and have added the attributes ElementName and Mode as below:

<Binding Path="CurrentProvider.IsBusy" ElementName="parent" Mode="OneWay" />

Hope this helps someone, even if the OP has fixed their issue.


May be you should try to add any temporary unused bound value. For instance:

<local:StaffAtMeetingEditor DataContext="{Binding Meeting}" Grid.Row="1">
    <local:StaffAtMeetingEditor.InEditMode>
        <MultiBinding Converter="{StaticResource myMeetingLogEditableMultiConverter}">
            <Binding Path="ParentSI.ItemInEditMode"/>
            <Binding Path="ParentSI"/>
        </MultiBinding>
    </local:StaffAtMeetingEditor.InEditMode>
</local:StaffAtMeetingEditor>

If it doesn't work then your implementation is wrong, another case - it's MultiBinding limitations.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜