How to disable highlight in RadPanelBarItem

10 posts, 0 answers
  1. yelong
    yelong avatar
    28 posts
    Member since:
    Aug 2006

    Posted 24 Nov 2008 Link to this post


    Hi there,

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

    Thanks,

    Yelong
  2. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 25 Nov 2008 Link to this post

    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.
  3. DevCraft banner
  4. yelong
    yelong avatar
    28 posts
    Member since:
    Aug 2006

    Posted 25 Nov 2008 Link to this post


    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
  5. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 26 Nov 2008 Link to this post

    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.
  6. Pavel
    Pavel avatar
    1 posts
    Member since:
    Jun 2009

    Posted 09 Aug 2010 Link to this post

    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)
  7. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 12 Aug 2010 Link to this post

    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
  8. Stefan Buys
    Stefan Buys avatar
    22 posts
    Member since:
    Dec 2009

    Posted 07 Feb 2011 Link to this post

    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
  9. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 09 Feb 2011 Link to this post

    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>>
  10. Stefan Buys
    Stefan Buys avatar
    22 posts
    Member since:
    Dec 2009

    Posted 11 Feb 2011 Link to this post

    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
  11. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 15 Feb 2011 Link to this post

    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>>
Back to Top
DevCraft banner