简体   繁体   English

BackStage模式下的Telerik RadPageView:如何在不使用全新主题的情况下更改所选项目的颜色?

[英]Telerik RadPageView in BackStage mode: howto change selected item color without whole new theme?

I'm looking for a way to set the color of an item in a RadPageView (in backstage mode) at runtime. 我正在寻找一种在运行时在RadPageView(后台模式)中设置项目颜色的方法。 There are a lot of properties that you can reach via the designer and the "Edit UI elements" section, they work well and they can simply override any theme settings as they are "inline", if you want to put it like that. 您可以通过设计器和“编辑UI元素”部分获得很多属性,它们可以很好地工作,并且可以简单地覆盖任何主题设置,因为它们是“内联”的(如果要这样放置)。 All I need is to change the background color of the selected item. 我需要做的就是更改所选项目的背景颜色。 Creating and applying a custom theme just for that seems a little over the top. 为此创建和应用自定义主题似乎有些困难。 Any ideas on how to set this property via code? 关于如何通过代码设置此属性的任何想法?

You can use the SelectedPageChanging event for this: 您可以为此使用SelectedPageChanging事件:

    void radPageView1_SelectedPageChanging(object sender, RadPageViewCancelEventArgs e)
    {
        e.Page.Item.BackColor = Color.Red;
        e.Page.Item.DrawFill = true;
        e.Page.Item.GradientStyle = GradientStyles.Solid;

        radPageView1.SelectedPage.Item.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
        radPageView1.SelectedPage.Item.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local);
        radPageView1.SelectedPage.Item.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local);
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM