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

How to use Brush from current theme

9 Answers 401 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jaroslav Půbal
Top achievements
Rank 1
Jaroslav Půbal asked on 23 Apr 2010, 10:06 AM
We have simple app with "Ribbon" above and "Grid" below.
This app can change theme. So the Ribbon colors is changing.

But Grid Backgroung is always white.
Now we found this solution:


        <telerikRibbonBar:RadRibbonBar x:Name="Ribbon" />
        <StackPanel>
            <Grid  Background="{Binding Background, ElementName=Ribbon}">
                    <Controls3:RadButton Content="Button text" />
                </Grid>
        </StackPanel>


Is there better solution? Is it possible reference theme brush without have any Telerik components on the form (user control).

9 Answers, 1 is accepted

Sort by
0
Accepted
Pana
Telerik team
answered on 28 Apr 2010, 01:16 PM
Hi Jaroslav Půbal,

When you set StyleManager.Theme on a Control in Silverlight the StyleManagers finds a Style in the Theme ResourceDictionaries that can be applied on the Control and sets the Control's Style property. It is not possible to go there and search for a specific Key or otherwise use StaticResource to reference resource in the Themes.

Eventually you can get our theme projects and add styles in them for your custom ContentControl that you can use as Border and the Theme for it will just change the Background and BorderBrush. This will be overkill though if all you need is to set a brush depending on the selected theme.

Sincerely yours,
Panayot
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Alexey Oyun
Top achievements
Rank 1
answered on 21 Jul 2010, 01:50 PM
Is there better way to get to base theme colors. Like in winforms you can get system colors.
May be it is possible to add property theme colors.
0
Pana
Telerik team
answered on 23 Jul 2010, 12:53 PM
Hi Alexey Oyun,

There is no easy way to access these colors. Eventually you can open the control's assembly with reflector and pick the brushes from its generic xaml for office_black. For the rest of the themes you can do the same with the theme assemblies. Eventually you can even merge one of those dictionaries in your app.xaml and reference the brushes as StaticResource but I haven't tried it yet. In that case you may get the styles from these resource dictionaries applied to all your controls since SL4 introduced Implicit Styling.

Greetings,
Panayot
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Alexey Oyun
Top achievements
Rank 1
answered on 23 Jul 2010, 01:12 PM
Thank you for replay, I will try your suggested way.

Thanks, Alexey.
0
Pana
Telerik team
answered on 23 Jul 2010, 01:37 PM
Hi Alexey Oyun,

If you have problems or need somewhat resources do not hesitate to contact us again.

Regards,
Panayot
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Heidi
Top achievements
Rank 1
answered on 03 Jun 2011, 09:45 AM
Hello,
In fact, I have the same question as described above. My application has a Ribbon on top, and below it, 2 regions with a menu bar and a content. I'd like to have these regions to inherit the background color of the Ribbon.
When themes are switched, (which can happen in our future apps) , the background should switch along. Therefore I would not like to define it separately.

I tried the example in the first post, but my application does not agree that there is a 'background' in the control 'telerik:RadRibbonBar'.

Is there nowadays a better solution to keep this dynamic, and still use telerik keyed colors?
0
Pana
Telerik team
answered on 08 Jun 2011, 11:58 AM
Hello Heidi,

Our theming mechanism does not support well such behavior. You will have to set Background to your user controls in code behind.

Best wishes,
Pana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Heidi
Top achievements
Rank 1
answered on 30 Jun 2011, 09:28 AM
Too bad it isn't supported! Will it be, in the future?

Isn't there some construction that an extra dictionary can reference to keys in the theme dll's of Telerik?
0
Pana
Telerik team
answered on 07 Jul 2011, 10:52 AM
Hi Heidi,

We are researching such methods. In WPF you could use DynamicResource but Silverlight does not support them yet. We are waiting the release of SL5 to check upon the new features and will try to figure it out. For now the only feasible way would be to create a home brew Background setting mechanism.

Greetings,
Pana
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
General Discussions
Asked by
Jaroslav Půbal
Top achievements
Rank 1
Answers by
Pana
Telerik team
Alexey Oyun
Top achievements
Rank 1
Heidi
Top achievements
Rank 1
Share this question
or