This is a migrated thread and some comments may be shown as answers.

[Solved] Cannot change text color through binding

2 Answers 263 Views
NumericBox for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jim
Top achievements
Rank 1
Jim asked on 17 Feb 2015, 06:17 PM
I can't seem to get the foreground text color to change unless I hardcode a color value directly in the numericTextBox template.  Here's what I've narrowed down to (when trying to diagnose why a disabled control doesn't show the text in the disabled font color):

1. I created a copy of the NumericTextBox template and added an explicit property setting of 

         Foreground="{TemplateBinding Foreground}"

to the "ContentElement" ScrollViewer.

2. Changed the first setter of the NumericTextBox template from:

        <Setter Property="Foreground" Value="{ThemeResource TelerikNumericBoxForegroundBrush}" />

to

        <Setter Property="Foreground" Value="Magenta" />

No change to the control.

3. Changed the property setting in step 1 to Foreground="Magenta" on the Scrollviewer and the color comes through.

I'm also modifying BorderThickness, which has a similar TemplateBinding on the ScrollViewer and that carries through. 

Why is the ScrollViewer Foreground binding not working here? 

For what it's worth, I tried the exact same steps with the Background property and it works fine.

2 Answers, 1 is accepted

Sort by
0
Ivaylo Gergov
Telerik team
answered on 20 Feb 2015, 09:07 AM
Hello Jim,

I am not sure that I understand you correctly. If you want to control the Foreground of the NumericTextBox through the RadNumericBox.Foreground property you can set the NumericTextBox.Foreground to {TemplateBinding Foreground}. 

If this is not the case, please elaborate more.

Regards,
Ivaylo Gergov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Jim
Top achievements
Rank 1
answered on 23 Feb 2015, 06:33 PM
I believe I had a couple of things in play at once and after pulling everything out into a separate app and building back up, have figured out what's going on.  I was forgetting the {CustomResource....} reference, but I do think there's an issue in rendering the text, so I've opened another thread that focuses on that specifically.
Tags
NumericBox for XAML
Asked by
Jim
Top achievements
Rank 1
Answers by
Ivaylo Gergov
Telerik team
Jim
Top achievements
Rank 1
Share this question
or