I have a modal xamDialogWindow that I have added to a ChildWindow. When the xamDialogWindow is shown, it is shown on the parent form of the ChildWindow, not on the ChildWindow itself.
Hi Competent, XamDialogWindow works very well with ChildWindow. You just need to set property RestrictInContainer="True" foe your XamDialogWindow. Here is a sample application - hope this cha help :-)
Cheers!
Mihail
<UserControl x:Class="XDWinChildWindow.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400" xmlns:ig="http://schemas.infragistics.com/xaml">
<Grid x:Name="LayoutRoot" Background="White">
<Controls:ChildWindow x:Name="MyChileWindow" Width="300" Height="200">
<Grid>
<ig:XamDialogWindow Height="80" Width="150" HorizontalAlignment="Left" RestrictInContainer="True" Name="xamDialogWindow1" VerticalAlignment="Top">
<TextBlock Text="Simple Content!!!"/>
</ig:XamDialogWindow>
</Grid>
</Controls:ChildWindow>
</UserControl>
There is also a secondary, probably related issue with this configuration: I added the xamDialogWindow to a usercontrol so that we could leverage its functionality in multiple windows, but now the control is throwing the following exception after the user control is loaded into the page (the xamDialogWindow does not have to be loaded for this exception to be thrown):
Message: Unhandled Error in Silverlight Application ) General Information*********************************************TimeStamp: 10/17/2010 4:27:17 PMAssembly: UITestAppDomainName: Silverlight AppDomain1) Exception Information*********************************************Exception Type: System.ArgumentExceptionMessage: Value does not fall within the expected range.StackTrace Information********************************************* at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData) at MS.Internal.XcpImports.MethodPack(IntPtr objectPtr, String methodName, Object[] rawData) at MS.Internal.XcpImports.UIElement_TransformToVisual(UIElement element, UIElement visual) at Infragistics.Controls.Interactions.XamDialogWindow.GetContainerPanelCoords(FrameworkElement container) at Infragistics.Controls.Interactions.XamDialogWindow.CenterDialogWindow() at Infragistics.Controls.Interactions.XamDialogWindow.XamWebDialogWindow_LayoutUpdated(Object sender, EventArgs e) at System.Windows.FrameworkElement.OnLayoutUpdated(Object sender, EventArgs e) at MS.Internal.JoltHelper.RaiseEvent(IntPtr target, UInt32 eventId, IntPtr coreEventArgs, UInt32 eventArgsTypeIndex) at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData) at MS.Internal.XcpImports.MethodPack(IntPtr objectPtr, String methodName, Object[] rawData) at MS.Internal.XcpImports.UIElement_TransformToVisual(UIElement element, UIElement visual) at Infragistics.Controls.Interactions.XamDialogWindow.GetContainerPanelCoords(FrameworkElement container) at Infragistics.Controls.Interactions.XamDialogWindow.CenterDialogWindow() at Infragistics.Controls.Interactions.XamDialogWindow.XamWebDialogWindow_LayoutUpdated(Object sender, EventArgs e) at System.Windows.FrameworkElement.OnLayoutUpdated(Object sender, EventArgs e) at MS.Internal.JoltHelper.RaiseEvent(IntPtr target, UInt32 eventId, IntPtr coreEventArgs, UInt32 eventArgsTypeIndex)Line: 1Char: 1Code: 0
Sorry, I should have been more specific about the situation. The ChildWindow is in a separate xaml page that is opened in code in response to a user action (the ChildWindow is shared among multiple controls which is why it is not defined in xaml). The code creates a new instance of the ChildWindow and then calls its Show method:
Dim oWindow As New FileUploader oWindow.Show()
The xamDialogWindow is defined in xaml on the ChildWindow control. The RestrictInContainer was already set.
<ig:XamDialogWindow Name="dlgProgress" Header="Uploading Files" Width="400" Height="124" Grid.RowSpan="2" IsModal="True" HeaderIconVisibility="Collapsed" StartupPosition="Manual" Visibility="Collapsed" VerticalAlignment="Center" HorizontalAlignment="Center" RestrictInContainer="True" IsResizable="False" IsTabStop="False" MaximizeButtonVisibility="Collapsed" MinimizeButtonVisibility="Collapsed" CloseButtonVisibility="Collapsed"> <StackPanel Margin="4"> <TextBlock Text="{Binding FileName}" Margin="0,6,0,10" /> <ProgressBar Height="15" Value="{Binding PercentCompleted}" /> <Button Content="Cancel" HorizontalAlignment="Center" Margin="0,10,0,0" Click="cmdCancelUpload_Click" /> <TextBlock Text="" Width="400" /> </StackPanel> </ig:XamDialogWindow>The dialog is shown in response to a user action: dlgProgress.Show()