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

GridViewLoadingIndicator's background can't change when I set ApplicationTheme programmatically.

1 Answer 40 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Yonghan
Top achievements
Rank 1
Yonghan asked on 29 Apr 2011, 04:50 AM
Hi.
I want set the background to transparent of GridViewLoadingIndicator.
But it doesn't work when I set ApplicationTheme programmatically.
And I made a sample based on 265667_SilverlightApplication162.zip sample code from the forum.

How do I set transarent background busy indicator with Office_Silver theme?
I want to chanage just busyIndicator's background.

Regards,
Yonghan Yoon

public App()
        {
            StyleManager.ApplicationTheme = new Office_SilverTheme(); 
             InitializeComponent();
  
            // Create a WebContext and add it to the ApplicationLifetimeObjects collection.
            // This will then be available as WebContext.Current.
            WebContext webContext = new WebContext();
            webContext.Authentication = new FormsAuthentication();
            //webContext.Authentication = new WindowsAuthentication();
            this.ApplicationLifetimeObjects.Add(webContext);
        }

<telerik:RadWindow.Resources>
    <LinearGradientBrush x:Key="GridView_LoadingIndicatorBackground" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFCBDFF4"/>
        <GradientStop Color="#FF557AA5" Offset="0.5"/>
        <GradientStop Offset="1" Color="White"/>
    </LinearGradientBrush>
    <SolidColorBrush x:Key="GridView_LoadingIndicatorBorder" Color="#995384BF" />
    <ControlTemplate x:Key="GridViewLoadingIndicatorTemplate" TargetType="telerik:GridViewLoadingIndicator">
        <Border x:Name="BusyIndicatorBackground" Background="Transparent">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Idle"/>
                    <VisualState x:Name="Loading">
                        <Storyboard RepeatBehavior="Forever">
                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="BusyIndicator">
                                <SplineDoubleKeyFrame KeyTime="00:00:01" Value="180"/>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Path x:Name="BusyIndicator" Data="M18,5.0000002 C10.820298,5 5,10.820298 5.0000002,18 5,25.179701 10.820298,31 18,31 25.179701,31 31,25.179701 31,18 31,10.820298 25.179701,5 18,5.0000002 z M18,0 C27.941126,0 36,8.0588746 36,18 36,27.941126 27.941126,36 18,36 8.0588746,36 0,27.941126 0,18 0,8.0588746 8.0588746,0 18,0 z" Fill="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Height="36" Margin="{TemplateBinding Padding}" RenderTransformOrigin="0.5,0.5" Stretch="Fill" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding BorderThickness}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Width="36">
                <Path.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform/>
                        <SkewTransform/>
                        <RotateTransform Angle="-180"/>
                        <TranslateTransform/>
                    </TransformGroup>
                </Path.RenderTransform>
            </Path>
        </Border>
    </ControlTemplate>
    <Style TargetType="telerik:GridViewLoadingIndicator">
        <Setter Property="Template" Value="{StaticResource GridViewLoadingIndicatorTemplate}"/>
        <Setter Property="Background" Value="{StaticResource GridView_LoadingIndicatorBackground}"/>
        <Setter Property="BorderBrush" Value="{StaticResource GridView_LoadingIndicatorBorder}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
    </Style>
</telerik:RadWindow.Resources>


<Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding Source={StaticResource SampleDataSource}}">
    <telerik:RadGridView ItemsSource="{Binding Collection}" IsBusy="True"/>
</Grid>

1 Answer, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 29 Apr 2011, 09:50 AM
Hi Yonghan,

 

Indeed each style is theme specific. Once you set the application theme, your custom style is being overriden.
However in this very specific case I believe that the best option is to use one of the approaches below:

                                                      "Modifying built-in theme"
                            "Creating a Custom Theme Project - Using the Telerik Approach"


Please let me know if you need any further assistance. 


Greetings,
Vanya Pavlova
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
Tags
GridView
Asked by
Yonghan
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Share this question
or