All the controls missing in WPF. Over 1 million downloads.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

237 lines
9.8 KiB

<!--**************************************************************************************
Toolkit for WPF
Copyright (C) 2007-2025 Xceed Software Inc.
This program is provided to you under the terms of the XCEED SOFTWARE, INC.
COMMUNITY LICENSE AGREEMENT (for non-commercial use) as published at
https://github.com/xceedsoftware/wpftoolkit/blob/master/license.md
For more features, controls, and fast professional support,
pick up the Plus Edition at https://xceed.com/xceed-toolkit-plus-for-wpf/
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
************************************************************************************-->
<local:DemoView x:Class="Xceed.Wpf.Toolkit.LiveExplorer.Samples.Window.Views.WindowContainerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Xceed.Wpf.Toolkit.LiveExplorer"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:xctkconv="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.LiveExplorer.Samples.Window.Converters"
xmlns:sample="clr-namespace:Xceed.Wpf.Toolkit.LiveExplorer.Samples.Window.Views"
Title="WindowContainer">
<local:DemoView.Description>
<Paragraph FontSize="14"
FontFamily="Segoe">
<Run>WindowContainer can be used to provide an area where a window-like control can be displayed. This is particularly useful in an XBAP application, where windows can't be popped up.</Run>
<LineBreak />
<LineBreak />
<Run>ChildWindow or MessageBox controls can be added and constrained in a WindowContainer. When a child of the WindowContainer is modal (modal ChildWindow or MessageBox), the background color of the WindowContainer can be set.</Run>
<LineBreak />
<LineBreak />
<Run>In WindowContainer, the modal windows (modal ChildWindow or MesssageBox) will always be in front, preventing the use of other windows from the WindowContainer.</Run>
</Paragraph>
</local:DemoView.Description>
<local:DemoView.Resources>
<xctkconv:SolidColorBrushToColorConverter x:Key="SolidColorBrushToColorConverter" />
<conv:WindowStateToBoolConverter x:Key="WindowStateToBoolConverter" />
<ObjectDataProvider x:Key="GenderEnum"
MethodName="GetValues"
ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="sample:GenderData" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</local:DemoView.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<GroupBox Header="Features"
Grid.Row="0"
Margin="5">
<Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="ModalBackgroundBrush:"
VerticalAlignment="Center" />
<xctk:ColorPicker x:Name="_modalBackgroundColorPicker"
Grid.Column="1"
SelectedColor="{Binding ModalBackgroundBrush, ElementName=_windowContainer, Converter={StaticResource SolidColorBrushToColorConverter}}"
Width="100"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="5" />
</Grid>
</GroupBox>
<Grid Grid.Row="1"
Margin="10"
TextElement.Foreground="{DynamicResource {x:Static SystemColors.ActiveCaptionTextBrushKey}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="Usage:"
Style="{StaticResource Header}" />
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel>
<CheckBox x:Name="_childWindowCheckBox"
Content="Child Window"
Margin="5"
IsChecked="{Binding WindowState, ElementName=_childWindow, Converter={StaticResource WindowStateToBoolConverter}}" />
<CheckBox x:Name="_modalChildWindowCheckBox"
Content="Modal Child Window"
Margin="5"
IsChecked="{Binding WindowState, ElementName=_modalChildWindow, Converter={StaticResource WindowStateToBoolConverter}}" />
<CheckBox x:Name="_messageBoxCheckBox"
Content="MessageBox"
Margin="5"
Checked="OnMessageBoxCheckBoxChecked"
Unchecked="OnMessageBoxCheckBoxUnchecked" />
</StackPanel>
<Grid Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition />
<ColumnDefinition Width="80" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<!--1st Column -->
<TextBlock Text="First Name:"
VerticalAlignment="Center"
Margin="10" />
<TextBox Grid.Column="1"
Text="Michael"
Width="150"
Height="30"
HorizontalAlignment="Left" />
<TextBlock Grid.Row="1"
Text="Last Name:"
VerticalAlignment="Center"
Margin="10" />
<TextBox Grid.Row="1"
Grid.Column="1"
Width="150"
Height="30"
Text="Thompson"
HorizontalAlignment="Left" />
<TextBlock Grid.Row="2"
Text="Address:"
VerticalAlignment="Center"
Margin="10" />
<TextBox Grid.Row="2"
Grid.Column="1"
Width="150"
Height="30"
Text="65 Main street"
HorizontalAlignment="Left" />
<!-- 2nd Column-->
<TextBlock Grid.Column="2"
Text="Gender:"
VerticalAlignment="Center"
Margin="10" />
<ComboBox Grid.Column="3"
Width="100"
Height="30"
ItemsSource="{Binding Source={StaticResource GenderEnum}}"
SelectedIndex="0"
Margin="5"
HorizontalAlignment="Left" />
<TextBlock Grid.Row="1"
Grid.Column="2"
Text="Job Title:"
VerticalAlignment="Center"
Margin="10" />
<TextBox Grid.Row="1"
Grid.Column="3"
Width="100"
Height="30"
Text="Plumber"
Margin="5"
HorizontalAlignment="Left" />
<TextBlock Grid.Row="2"
Grid.Column="2"
Text="Salary:"
VerticalAlignment="Center"
Margin="10" />
<xctk:IntegerUpDown Grid.Row="2"
Width="100"
Grid.Column="3"
Height="30"
Value="30000"
Increment="5000"
Margin="5"
HorizontalAlignment="Left" />
</Grid>
<Border Grid.Column="1"
BorderBrush="Black"
BorderThickness="2"
Margin="5,0,0,0">
<xctk:WindowContainer x:Name="_windowContainer"
ModalBackgroundBrush="#80000000">
<xctk:ChildWindow x:Name="_childWindow"
Caption="Modaless ChildWindow"
Left="75"
Top="50"
Width="275"
Height="125"
WindowState="Open">
<TextBlock Text="This is a regular Child Window"
Padding="10" />
</xctk:ChildWindow>
<xctk:ChildWindow x:Name="_modalChildWindow"
Caption="Modal ChildWindow"
IsModal="True"
Left="175"
Top="125"
Width="275"
Height="125"
WindowState="Open">
<TextBlock Text="This is a modal Child Window"
Padding="10" />
</xctk:ChildWindow>
<xctk:MessageBox x:Name="_messageBox"
Caption="MessageBox"
Text="This is a MessageBox, always modal"
Closed="OnMessageBoxClose" />
</xctk:WindowContainer>
</Border>
</Grid>
</Grid>
</Grid>
</local:DemoView>