Vaccano
Vaccano

Reputation: 82467

Do an "Is" condition in xaml

Is it possible to do an "IS" condition in xaml?

<Condition 
    Binding="{Binding RelativeSource={RelativeSource Self}, Path=Type}" 
    Value="MyNamespace.MyClass" />

There is no property called Type on the class I need. There is the ever-present GetType() method, but I don't know how to call that here to make the condition comparison.

Is there a way to do this?

Upvotes: 0

Views: 204

Answers (1)

brunnerh
brunnerh

Reputation: 185225

Just put in a converter to do that logic, you can pass the type to compare as parameter (use x:Type) and return true or false (set the Condition.Value to true).

Upvotes: 4

Related Questions