Version

The xamDialogWindow Control’s Behavior

The xamDialogWindow™ control has the following behaviors:

  • The xamDialogWindow control cannot be moved outside of its container

  • The xamDialogWindow control cannot be resized larger that its container

  • When the end user maximizes the xamDialogWindow control, it will fill the container. If the container’s size is dynamic and you resize it, then the xamDialogWindow control will continue to fill the space of the container.

  • The xamDialogWindow control can only gain focus over other dialog windows in the same container.

Setting the xamDialogWindow control’s attached properties such as Canvas.Top, Canvas.Left, Grid.Row and Grid.Column will cause some undesirable behavior. If you want to restrict the dialog window to a container, you should set the attached properties on the container that contains the dialog.

The following code demonstrates how to restrict the dialog window to the second column and the second row of the grid panel.

In XAML:

<Grid x:Name="LayoutRoot" Background="White" ShowGridLines="True">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="100"></ColumnDefinition>
        <ColumnDefinition></ColumnDefinition>
        <ColumnDefinition Width="400"></ColumnDefinition>
    </Grid.ColumnDefinitions>

    <Grid.RowDefinitions>
        <RowDefinition></RowDefinition>
        <RowDefinition Height="200"></RowDefinition>
        <RowDefinition Height="50"></RowDefinition>
    </Grid.RowDefinitions>

    <Border Grid.Column="1" Grid.Row="1"
        BorderBrush="Black" BorderThickness="2">
        <ig:XamDialogWindow x:Name="Dialog1" Header="Dialog1">
        </ig:XamDialogWindow>
    </Border>
</Grid>

You can also have multiple dialog windows restricted to the same container. This can be done by using another panel inside of the container.

The following code demonstrates how to achieve this.

In XAML:

<Grid x:Name="LayoutRoot" Background="White" ShowGridLines="True">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="100"></ColumnDefinition>
        <ColumnDefinition ></ColumnDefinition>
        <ColumnDefinition Width="400"></ColumnDefinition>
    </Grid.ColumnDefinitions>

    <Grid.RowDefinitions>
        <RowDefinition></RowDefinition>
        <RowDefinition Height="200"></RowDefinition>
        <RowDefinition Height="50"></RowDefinition>
    </Grid.RowDefinitions>

    <Border Grid.Column="1" Grid.Row="1" BorderBrush="Black"
        BorderThickness="2">
        <Grid>
            <ig:XamDialogWindow x:Name="Dialog1">
            </ig:XamDialogWindow>

            <ig:XamDialogWindow x:Name="Dialog2">
            </ig:XamDialogWindow>
        </Grid>
    </Border>
</Grid>