Domanda

I'm having a difficult time changing the CaretBrush in a RadMaskedTextBox. I'm using WPF and implementing the ExpressionDark theme. The problem is that the caret is black, and against the dark theme, it's difficult to see where the caret is in the textbox. I found this from a Telerik rep:

"The RadMaskedTextBox uses a TextBox internally to display its text. The TextBox exposes a CaretBrush property which you can use to change the color of the caret. You can modify the default template of the control and set this property on the TextBox inside."

But that doesn't provide an example of how to do it. I've tried adding a TextBox style, with a white CaretBrush, but the RadMaskedTextBox isn't picking that up. Any ideas?

È stato utile?

Soluzione

All I had to do was add this to my app.xaml:

xmlns:telerikMask="clr-namespace:Telerik.Windows.Controls.MaskedTextBox;assembly=Telerik.Windows.Controls.Input"

<Style TargetType="telerikMask:ExtendedTextBox">
  <Setter Property="CaretBrush" Value="White" />
</Style>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top