Changing Font foreground color when Rab tab get selected

4 posts, 0 answers
  1. Rohit
    Rohit avatar
    2 posts
    Member since:
    Nov 2011

    Posted 03 Nov 2011 Link to this post

    Hello,

    A very good morning to everyone, I have started using telerik controls since last 15 days approx. I am using "RAD Tab" for silver light
    through expression blend 4.

    So the basic idea to modify the Rad Tab through expression blend in a normal which you do is edit a copy and you can change the
    background color of the Tab border and others.

    The main problem which I am facing and I am not getting that how to change the Font Foreground when you select the Tab. I did try various options I am able to change the border,background, Font normal and other customizations!

    I am only stuck at how to change the font foreground color  when the Tab get selected as I have light grey and dark blue theme modifiedfor it. So in normal scenario the tab foregorund font is dark blue with a light grey gradient background and when the specific tab got selected The font foreground color should get changed to white with a blue background.

    Can you please throw some light on it!


    Thank You
    Rohit Yog
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 07 Nov 2011 Link to this post

    Hi Rohit,

     Please examine the attached project where a databinding approach is used to meet your requirements.
    Feel free to ask if you need further assistance.

    Kind regards,
    Petar Mladenov
    the Telerik team

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

  3. DevCraft banner
  4. Rohit
    Rohit avatar
    2 posts
    Member since:
    Nov 2011

    Posted 08 Nov 2011 Link to this post

    Hi Petar,

    Many thanks for the solution!, right now the solution which you have given is for instance we need to manually put that code so the
    foreground color will get changed.

    The current scenario at my end is that - We have create custom themes for all telerik controls which we are using for e.g Tab,Grid,button.
    So what ever we modify the code get creates in you can say "style.xaml". One more thing whatever modifications we are doing is through expression blend..

    So is there any exclusive way in which I can put the "Selected" style property in our style.xaml which of course will include all other styles like normal,mouse over and many other custom styles.

    We have used this solution for creating custom themes:

    1) http://www.telerik.com/help/silverlight/common-styling-apperance-themes-custom-theme-project-telerik-approach.html




    Thank You
    Rohit Yog
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 11 Nov 2011 Link to this post

    Hi Rohit,

     I am not sure I understand your exact requirement. If you need to move these resources in another file:

    <Grid.Resources>
               
              <local:BoolToForegroundConverter x:Key="converter" />
               
              <telerik:ContainerBindingCollection x:Key="contCollection">
                  <telerik:ContainerBinding PropertyName="Foreground" Binding="{Binding Selected, Converter={StaticResource converter}}" />
                  <telerik:ContainerBinding PropertyName="Background" Binding="{Binding BackGroundColor}" />
                  <telerik:ContainerBinding PropertyName="IsSelected" Binding="{Binding Selected, Mode=TwoWay}" />
              </telerik:ContainerBindingCollection>
     
              <DataTemplate x:Key="template" telerik:ContainerBinding.ContainerBindings="{StaticResource contCollection}">
                  <TextBlock Text="{Binding Name}" />
              </DataTemplate>
          </Grid.Resources>
    Yes it is possible. But if you need to use same Foreground for every RadTabItem, when it gets selected, yes you can edit the Selected VisualState of in the RadTabItem's Template and set animation that changes the foreground property. Feel free to ask if you need further assistance. Greetings,
    Petar Mladenov
    the Telerik team

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

Back to Top