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

Background color in Modal Window

3 Answers 131 Views
Window
This is a migrated thread and some comments may be shown as answers.
Ben Hayat
Top achievements
Rank 2
Ben Hayat asked on 29 Nov 2011, 02:46 AM
Hello Team;

When we display a modal Window, the background turns to a "Purple" color. Is it possible for us to change that color? If not, could you change it to a Gray color that is more industry STD?

Thanks!

3 Answers, 1 is accepted

Sort by
0
Accepted
Dani
Telerik team
answered on 29 Nov 2011, 10:17 AM
Hello Ben,

The default modal background for RadWindow dialogs is the following brush:
<LinearGradientBrush x:Key="WindowModalBackground" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#E5000000" />
        <GradientStop Color="#4C000000" Offset="0.5" />
        <GradientStop Color="#E5000000" Offset="1" />
    </LinearGradientBrush>

You can easily change that by setting the ModalBackground property of RadWindow. For example:
<LinearGradientBrush x:Key="WindowModalBackground" EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
    <GradientStop Color="#CC012A7C" Offset="0.987"/>
    <GradientStop Color="#CC84ABF9"/>
</LinearGradientBrush>      
      
<Style x:Key="RadWindowStyle1" TargetType="telerik:RadWindow">          
    <Setter Property="ModalBackground" Value="{StaticResource WindowModalBackground}"/> 
</Style>

I hope this will help.

Greetings,
Dani
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Ben Hayat
Top achievements
Rank 2
answered on 29 Nov 2011, 04:20 PM
And is best to include it in App.xaml to have global effect?
0
Dani
Telerik team
answered on 30 Nov 2011, 09:43 AM
Hello Ben ,

Yes, if you place the style in App.xaml it will be accessible from all RadWindows you may have in your application. Yet the style must be explicit, i.e. with an x:Key. You can then apply it to any RadWindow in your application. For example:
private void RadButton_Click(object sender, RoutedEventArgs e)
        {
            MyWindow w = new MyWindow();
  
            w.Height = 300;
            w.Width = 600;
            w.Style = Application.Current.Resources["MyStyle"] as Style;
  
            w.WindowStartupLocation = Telerik.Windows.Controls.WindowStartupLocation.CenterScreen;
            w.ShowDialog();
        }
 
I hope this helps.

Greetings,
Dani
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
Window
Asked by
Ben Hayat
Top achievements
Rank 2
Answers by
Dani
Telerik team
Ben Hayat
Top achievements
Rank 2
Share this question
or