Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

Manually set style for a given control from Telerik implicit Theme (Office2013)

$
0
0

I would like to use the 'accent'/'selected' color from my office 2013 implicit theme for a generic control (in my case I am using a Hyperlink inside a TextBlock - I have two of those) in code/xaml to show the selected/unselected color depending on whether the user clicks on one or the other link, i.e. if the user clicks on option 1, I'd like to apply the corresponding color/brush that'd show that it is selected, when the user clicks on option 2, then, I'd like to return option 1 to the default color and have Option 2 switch to the 'selected' one. 

 I have approached it somehow as follows (I changed the hyperlink to a RadButton hopping that it'd help):

                        <telerik:RadButton  x:Name="ShowDashboardHyperlink" Click="ShowDashboardHyperlink_OnClick" Content="DASHBOARD">

                                <telerik:RadButton.Style>
                                    <MultiBinding Converter="{StaticResource StyleConverter}">
                                        <MultiBinding.Bindings>
                                            <Binding RelativeSource="{RelativeSource Self}" />
                                            <Binding Path="DashboardStyle" />
                                        </MultiBinding.Bindings>
                                    </MultiBinding>
                                </telerik:RadButton.Style>
                            </telerik:RadButton>

 

With a style converter like:

 

public class StyleConverter : IMultiValueConverter

{

blah...

}

And on my view model:

 

        public string DashboardStyle
        {
            get { return _dashboardStyle; }
            set
            {
                _dashboardStyle = value;
                RaisePropertyChanged(() => DashboardStyle);
            }
        }

Somewhere in my constructor I initialize my colors:

            DashboardStyle = "AccentMainBrush";
            CalendarStyle = "BasicBrush";

It compiles and all but I think the part that I don't get right is the binding.

 

I'll appreciate any help.


Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>