wpf ChildWindow


First Adding Reference to WPF Toolkit Extended Assembly


Creating a ChildWindow
<Window x:Class="ExtendedWPF.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:wpfx="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <wpfx:ChildWindow Name="PopupChildWindow" Caption="Child Window" Height="200" IsModal="True" Margin="105,0,0,47" Width="306" HorizontalAlignment="Left" VerticalAlignment="Bottom" />
        <Button Content="Show Child Window" Height="23" HorizontalAlignment="Left" Margin="371,12,0,0" Name="ShowChildWindow" VerticalAlignment="Top" Width="120" Click="ShowChildWindow_Click" />
    </Grid>
</Window>

Make a Child Window visible.
private void ShowChildWindow_Click(object sender, RoutedEventArgs e)
        {
            PopupChildWindow.Show();
        }

Output
wpf childwindow


Customizing Caption

<Window x:Class="ExtendedWPF.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:wpfx="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <wpfx:ChildWindow Name="PopupChildWindow" Width="420" Height="200" IsModal="True" Margin="41,37,0,0">
            <wpfx:ChildWindow.Caption >
                <WrapPanel Orientation="Horizontal" Background="Gray" Height="61" Width="407">
                    <Rectangle Width="28" Height="28" Fill="Green" />
                    <TextBlock Text="Title" FontSize="25" Foreground="Green"></TextBlock>
                    <Ellipse Width="40" Height="40" Fill="Yellow" />
                    <Image Height="58" HorizontalAlignment="Left" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="98" Source="/ExtendedWPF;component/Images/Chrysanthemum.jpg" />
                </WrapPanel>
            </wpfx:ChildWindow.Caption>
        </wpfx:ChildWindow>
        <Button Content="Show Child Window" Height="23" HorizontalAlignment="Left" Margin="371,12,0,0" Name="ShowChildWindow" VerticalAlignment="Top" Width="120" Click="ShowChildWindow_Click" />
    </Grid>
</Window>

Output



wpf ChildWindow wpf ChildWindow Reviewed by Bhaumik Patel on 10:04 PM Rating: 5