Version

Customize Modal Dialog Window Background

A modal dialog window always maintains the active window status until it is closed. When a modal dialog window is opened, your end user cannot interact with any other part of the application until the dialog window is closed.

When a dialog window is open, the rest of the application is grayed out. However, you can change this default style by setting the xamDialogWindow control’s ModalBackground, ModalBackgroundOpacity and ModalBackgroundEffect properties.

The following code demonstrates how to set these modal dialog properties.

In XAML:

<Grid x:Name="LayoutRoot" Background="White">
   <ig:XamDialogWindow x:Name="DialogWindow" Width="200"
       Height="200" Content="This is a sample dialog"
       IsModal="True"
       ModalBackground="Green" ModalBackgroundOpacity="0.8">
      <ig:XamDialogWindow.ModalBackgroundEffect>
         <BlurEffect Radius="10"/>
      </ig:XamDialogWindow.ModalBackgroundEffect>
   </ig:XamDialogWindow>
</Grid>

In Visual Basic:

Imports System.Windows.Media.Effects
...
Dim modalBrush As New SolidColorBrush()
modalBrush.Color = Colors.Green
DialogWindow.ModalBackground = modalBrush
DialogWindow.ModalBackgroundOpacity = 0.8

Dim myBlurEffect As New BlurEffect()
blurEffectModal.Radius = 10
DialogWindow.ModalBackgroundEffect = blurEffectModal

In C#:

using System.Windows.Media.Effects;
...
SolidColorBrush colorModal = new SolidColorBrush();
colorModal.Color = Colors.Green;
DialogWindow.ModalBackground = colorModal;
DialogWindow.ModalBackgroundOpacity = 0.8;
BlurEffect blurEffectModal = new BlurEffect();
blurEffectModal.Radius = 10;
DialogWindow.ModalBackgroundEffect = blurEffectModal;
Customize Modal Dialog Window Background