IIF in XAML

JumpyNET

Centurion
Joined
Apr 4, 2005
Messages
196
What would be the best way to do the following in XAML?

<StackPanel
Grid.Row=IIF(Orientation="Portrait","2","1")
Grid.Column=IIF(Orientation="Portrait","0","2")
>

------------------------------------------------------------------------

At first I was thinking of using a ValueConverter but they do not seem to support multiple parameters. I guess passing both of the parameters in a single string such as "2|1" (which I would them split in my ValueConverter) would be bad practice, I was wondering could it be possible to do something like the following?

<StackPanel
Grid.Row="{Binding Orientation, ConverterParameter=[[new CustomClass(2,0)]], Converter={StaticResource OrientationToIntegerConverter}, ElementName=phoneApplicationPage}"

Grid.Column="{Binding Orientation, ConverterParameter=[[new CustomClass(1,2)]], Converter={StaticResource OrientationToIntegerConverter}, ElementName=phoneApplicationPage}"
>
 
Last edited:
Back
Top