Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > General Discussions > Apply Theme in TextBox

Answered Apply Theme in TextBox

Feed from this thread
  • Eduardo avatar

    Posted on Apr 3, 2009 (permalink)

    How to Apply the "RadThemes" in Controls as a TextBox?

    Reply

  • Answer Kaloyan Kaloyan admin's avatar

    Posted on Apr 3, 2009 (permalink)

    Hello Eduardo,

    Actually, our themes provide styles for some of the standard controls, however, there is no style for the textbox control at the moment. We will consider enhancing the range of standard controls that are stylized by our themes for the upcoming Q2 release due in the summer.

    Regards,
    Kaloyan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.

    Reply

  • peter Intermediate avatar

    Posted on Jan 26, 2012 (permalink)

    This is an old item, but i notice that there still is no support for the textbox in the Expression Dark theme.

    Because of this the carret in the textbox stays black, which makes it difficult to see. Changing the carret brush manually has a nasty side effect in our code that it will sometimes simply disappear (i suppose it gets the same color as the textbox itself.

    Is this a bug in the Expression dark theme?


    Reply

  • Vanya Pavlova Vanya Pavlova admin's avatar

    Posted on Jan 30, 2012 (permalink)

    Hello Peter,

     

    You may simply set the CaretBrush of the TextBox to match the corresponding default Foreground for Expression_Dark theme and everything will work as expected:


    <TextBox CaretBrush="#FFd2d2d2" Width="150" FontSize="26" telerik:StyleManager.Theme="Expression_Dark"/>


    Can you verify how this works for you? 



    Regards, 
    Vanya Pavlova
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

  • peter Intermediate avatar

    Posted on Jan 31, 2012 (permalink)

    Hi Vanya,

    Surely this will work. I'm already applying this technique.But in fact this means that we are unable to let the user switch themes as we "hard code" every TextBlock control to use one theme.

    I also tried this (in app.xaml) but it's not working (surprisingly, it does work for less frequently used controls like a CheckBox):

    ...

    <telerik:Expression_DarkTheme IsApplicationTheme="True" x:Key="Theme" />

    <Style TargetType="TextBlock" telerik.StyleManager.BasedOn="{StaticResource Theme}">

    ...

    Why is this not working for a very common control like the textbox or is there a more general approach so i am able to provide the possibility to switch themes on the fly, and most importantly, not having to set the CaretBrush on every textbox control?

    Best Regards,

    Peter

    Reply

  • Vanya Pavlova Vanya Pavlova admin's avatar

    Posted on Jan 31, 2012 (permalink)

    Hello Peter,

     
    I would like to shed some light on that matter. Keep in mind that the Telerik themes can be applied to the following native Silverlight controls:


    1.System.Windows.Button
    2.System.Windows.CheckBox
    3.System.Windows.ListBox
    4.System.Windows.RadioButton
    5.System.Windows.ScrollViewer
    6.System.Windows.PasswordBox
    7.System.Windows.RepeatButton
    8.System.Windows.TextBox


    The TextBlock is not included in this list, since an implicit style targeted at TextBlock will style all text elements within your application. Setting an application wide theme will be evaluated at runtime.
    When you apply the theme at runtime indeed only RadControls will be styled - not the native ones, which are being supported by our theming mechanism. If you want to style these native controls based on the current application theme you should manually set the corresponding theme, as shown below: 

    App.xaml:

                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                 x:Class="RadTest.App"
                 >
        <Application.Resources>
            <Style TargetType="TextBox">
                  <Setter Property="CaretBrush" Value="#FFD2D2D2"/>
           </Style>
        </Application.Resources>
    </Application>


    App.xaml.cs:

    public App()
          {
              this.Startup += this.Application_Startup;
              this.Exit += this.Application_Exit;
              this.UnhandledException += this.Application_UnhandledException;
              StyleManager.ApplicationTheme = new Expression_DarkTheme();
              InitializeComponent();
             StyleManager.SetBasedOn(((Style)Current.Resources[typeof(TextBox)]), StyleManager.ApplicationTheme);
          }


    Will you verify how this works for you? 


    Greetings,
    Vanya Pavlova
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > General Discussions > Apply Theme in TextBox