question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue setting foreground color of TextBox via ChangePropertyAction

See original GitHub issue

I try to set the Foreground property of a TextBox via a DataTriggerBehavior and ChangePropertyAction:

<TextBox Name="LastName" Text="{Binding Person.LastName}"> <i:Interaction.Behaviors> <ia:DataTriggerBehavior Binding="{Binding Person.LastName, Converter={StaticResource toLowerStringConverter}}" ComparisonCondition="Equal" Value="schulz"> <ia:ChangePropertyAction TargetObject="{Binding #LastName}" PropertyName="Foreground" Value="#FF0000" /> </ia:DataTriggerBehavior> </i:Interaction.Behaviors> </TextBox>

But the TextBox doesnt show the letters at all, although you can see that it has content because you can see some “spaces” inside the TextBox: image

I attached an example solution. AvaloniaTest.zip

I am using the latest version 0.9.12

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

github_iconTop Results From Across the Web

wpf - How to change all TextBox's Foreground Color in an ...
To change the Foreground color of all textbox's, then change the commonly defined resource's color. Below I changed the color in button click....
Read more >
Apply Style in ChangePropertyAction · Issue #50
If Peron.LastName has a specific value i want the foreground color to be red, else I want it to have the default color...
Read more >
TextBlock.Foreground Property (System.Windows.Controls)
The default is Black. Examples. The following example shows how to set the Foreground attribute of a TextBlock element. XAML
Read more >
Solved: Change background color of text box
Solved: Good day How would I change the background color of a textbox in power bi? ... Select the text box you want...
Read more >
How to set the foreground color of the TextBox in C#? - ...
How to set the foreground color of the TextBox in C#? ; Step 1 : Create a textbox using the TextBox() constructor provided...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found