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

How to disable highlight in RadPanelBarItem

9 Answers 280 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
yelong
Top achievements
Rank 1
yelong asked on 24 Nov 2008, 10:42 PM

Hi there,

I'd like to know how to disable the highlight effect when mouseover in RadPanelBarItem.

Thanks,

Yelong

9 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 25 Nov 2008, 07:47 AM
Hello Yelong,

There are the templates for RadPanelBarItem - top template (the default) and child template (when pnalebar item is child of panelbar item).
To remove the highlight you should comment this lines from RadPanelBarItem template:

For top template:

<vsm:VisualState x:Name="MouseOver">  
    <Storyboard> 
        <DoubleAnimation Storyboard.TargetProperty="Opacity" 
                Storyboard.TargetName="OuterBorder" To="1.0" Duration="0:0:0.2" /> 
        <DoubleAnimation Storyboard.TargetProperty="Opacity" 
                Storyboard.TargetName="InnerBorder" To="1.0" Duration="0:0:0.2" /> 
        <DoubleAnimation Storyboard.TargetProperty="Opacity" 
                Storyboard.TargetName="HeaderRow" To="1.0" Duration="0:0:0.2" /> 
 
        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="OuterBorder" 
                Storyboard.TargetProperty="BorderBrush" Duration="0">  
            <DiscreteObjectKeyFrame KeyTime="0" 
                    Value="{StaticResource MouseOverBrush}" /> 
        </ObjectAnimationUsingKeyFrames> 
 
        <!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderRow" 
                Storyboard.TargetProperty="Background" Duration="0">  
            <DiscreteObjectKeyFrame KeyTime="0" 
                    Value="{StaticResource MouseOverBrush}" /> 
        </ObjectAnimationUsingKeyFrames>--> 
    </Storyboard> 
 
</vsm:VisualState> 


for child template comment this:

<vsm:VisualState x:Name="MouseOver">  
    <!--<Storyboard> 
        <DoubleAnimation Storyboard.TargetProperty="Opacity" 
                Storyboard.TargetName="MouseOverVisual" To="1.0" 
                Duration="0:0:0.2" /> 
    </Storyboard>--> 
</vsm:VisualState> 

If you need more information, I'll be glad to help.


Greetings,
Hristo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
yelong
Top achievements
Rank 1
answered on 25 Nov 2008, 07:32 PM

Hi Hristo,

Thank you for your reply.

But I don't know how to change the template. I just have the dlls. Where can I find the templates definition?

In fact, I just use the code to create the controls like below. Any way to change it in code?

RadPanelBar pnl = new RadPanelBar();
RadPanelBarItem exp = new RadPanelBarItem() { Header = "header", IsExpanded = true };
exp.Items.Add(new TextBlock{Text="content"});
pnl.Items.Add(exp);

Thanks,

Yelong
0
Hristo
Telerik team
answered on 26 Nov 2008, 05:17 PM
Hi Yelong,

Silverlight 2 doesn't support creation of ControlTemplate in code. Only from XAML.
You can read from here:
http://blogs.telerik.com/valentinstoychev/posts/08-11-19/Tweaking_the_Theme_colors_for_Telerik_Silverlight_Controls.aspx

how to edit the styles of RadControls. You will need to download the TelerikThemingApplication from the blogpost or from here: http://blogs.telerik.com/Libraries/Valentin_Stoychev/TelerikThemingApplication.sflb
and you will be able to edit the style of RadPanelBarItem and remove MouseOver state.

Let me know if you need more help.


Sincerely yours,
Hristo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Pavel
Top achievements
Rank 1
answered on 09 Aug 2010, 09:34 PM
I downloaded the project. It compiled and ran fine in SL3. Then I made the only change: switched both project to Silverlight 4. NOw at runtime I am getting the exception at InitializeComponent in RawWindowBlend class:

Set property 'Telerik.Windows.Controls.ResourceDictionary.MergedDictionaries' threw an exception. [Line: 10 Position: 24]

A resource with key 'Telerik.Windows.Controls.RadCube' cannot be found in '/Telerik.Windows.Controls.Navigation;component/Themes/Cube.xaml'.
   at Telerik.Windows.Controls.ResourceDictionary.MergeWith(ResourceDictionary dictionary)
   at Telerik.Windows.Controls.ResourceDictionary.OnMergedDictionariesChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
   at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
   at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   at Telerik.Windows.Controls.ResourceDictionary.SetMergedDictionaries(DependencyObject obj, ResourceDictionary value)
0
Miroslav
Telerik team
answered on 12 Aug 2010, 11:25 AM
Hi Pavel,

This example is from 2008 when there was Silverlight 2 and may be out of date.

The highlight of a control can be changed by editing its ControlTemplate, for example in Expression Blend by right clicking on the control -> edit template -> edit a copy.

Regards,
Miroslav
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
Stefan Buys
Top achievements
Rank 2
answered on 07 Feb 2011, 11:02 AM
Hi,

I have the same question as Yelong and the first reply from Hristo, suggesting to comment out some storyboard animations, is exactly what I needed to do. I do have the latest Silverlight RadControls installed (Q3 2010 SP1) and manage to get it working.

However, my Silverlight application is using a Theme set in the App.xaml.cs file: 

StyleManager.ApplicationTheme = new Office_BlueTheme();

I notice in runtime that my RadPanelBarItem renders the "Office_Black" look and feel which is the styles present in the modified style resources. I don't have any other Telerik control template customizations as I rely on the StyleManager to theme all controls for me.

How do I edit the RadPanelBarItem template to disable the mouse over events as well as ensure that the control will render according to my App.xaml.cs theme setting?

Thanks,
Stefan
0
Petar Mladenov
Telerik team
answered on 09 Feb 2011, 04:52 PM
Hello Stefan Buys,

You can find the RadPanelBar Office Blue style file from the Themes folder of your RadControls installation folder. Please find the attached project where the style is copied and you can edit it. Feel free to ask if you need further assistance. 

Greetings,
Petar Mladenov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Stefan Buys
Top achievements
Rank 2
answered on 11 Feb 2011, 11:15 AM
Hi Peter,

Thanks for sample, but I was hoping for a more dynamic way to change the application theme. The Office Blue theme is just an illustration. I would like to know if there is a way to ensure that the control can style automatically according to setting the application theme. I suppose one can create different style setters for each theme as you mentioned and apply it dynamically, but I am looking for a neater solution.

Please advise,
Stefan
0
Petar Mladenov
Telerik team
answered on 15 Feb 2011, 04:01 PM
Hi Stefan Buys,

Currently, this is the only way of editing a non-default theme. Please let us know if you need more info.

Regards,
Petar Mladenov
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
PanelBar
Asked by
yelong
Top achievements
Rank 1
Answers by
Hristo
Telerik team
yelong
Top achievements
Rank 1
Pavel
Top achievements
Rank 1
Miroslav
Telerik team
Stefan Buys
Top achievements
Rank 2
Petar Mladenov
Telerik team
Share this question
or