4

I want to do something similar to this post but using MultipleBindings.

So something like this:

    <Button.CommandParameter>
        <MultiBinding Converter="{StaticResource commandParametersConverter}">
            <MultiBinding.Bindings>
                <Binding Path="DataContext" />
                <Binding Path="{x:Static vm:Direction.Down}" Mode="OneWay"/>
            </MultiBinding.Bindings>
        </MultiBinding>
    </Button.CommandParameter>

The line:

    <Binding Path="{x:Static vm:Direction.Down}" Mode="OneWay"/>

Throws error: Object reference not set to an instance of an object. I assume a static is not permitted in this context, so what's the next best option?

1 Answer 1

7

Change Path to Source in <Binding Path="{x:Static vm:Direction.Down}" Mode="OneWay"/>:

<Button.CommandParameter>
    <MultiBinding Converter="{StaticResource commandParametersConverter}">
        <MultiBinding.Bindings>
            <Binding Path="DataContext" />
            <Binding Source="{x:Static vm:Direction.Down}" Mode="OneWay"/>
        </MultiBinding.Bindings>
    </MultiBinding>
</Button.CommandParameter>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.