Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ternary expression with color #17

Closed
titouancreach opened this issue Jun 10, 2015 · 1 comment
Closed

Ternary expression with color #17

titouancreach opened this issue Jun 10, 2015 · 1 comment
Milestone

Comments

@titouancreach
Copy link

As the same as

<TextBlock Text="{c:Binding '(1 == 2) ? 10 : 20'}" />

We may expect that

<TextBlock Text="Test" Foreground="{c:Binding '(1 == 1) ? #ff0000 : #000000'}" VerticalAlignment="Center"/>

display text in red.
Unfortanutelly, no text is displayed

Thank you :)

@Alex141 Alex141 added this to the 2.3.0.0 milestone Oct 6, 2016
@Alex141
Copy link
Owner

Alex141 commented Nov 13, 2016

Now you can write something like:

<Button Background="{c:Binding '(A > B ? media:Brushes.LightBlue : media:Brushes.White)'}"/>

where 'media' is defined as:

xmlns:media ="clr-namespace:System.Windows.Media;assembly=PresentationCore"

in header of xaml, see documentation

@Alex141 Alex141 closed this as completed Nov 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants