When the dialog window is first instantiated, the close button works as expected. But after re-displaying the window the close button doesn't work until some other action is performed on the window such as setting it from maximized to windowed or minimized or vise versa. Then the close button works again.
It would be more MVVM friendly to show/hide the XamDialogWindow using property rather than calling the Show() method. This would allow us to to bind the window state a value that is set in the ViewModel & not have to write any code behind to call Show()
ah! yes, that works. Not exactly sure why I didn't think of that before.
Thanks much!
Hello Rick,
I was able to replicate the behavior you described using your code and was able to fix it by using the Show method to visualize the xamDialogWindow, which is the intended way for doing that. Just by setting the visibility you still haven’t changed the Closed state, that is why you can’t close and move it.
Please let me know if you require any further assistance on the matter.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support
Ok, narrowed it down to the window is being created inside a grid that is within a DockPanel from the SDK. Also, after the window is closed, it's not being distroyed so I'm checking for it in the child collection of the grid before creating a new one and re-using it.
here is the xaml:
<UserControl x:Class="TestInfragisticsDialogWindow.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:ig="http://schemas.infragistics.com/xaml"
mc:Ignorable="d"
d:DesignHeight="478" d:DesignWidth="637" xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit">
<Grid x:Name="LayoutRoot" Background="White">
<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="62,421,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
<toolkit:DockPanel Height="349" Name="dockPanel1" VerticalAlignment="Top">
<Grid x:Name="grid1" Margin="0" toolkit:DockPanel.Dock="Right" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Width="637">
</Grid>
</toolkit:DockPanel>
</UserControl>
Here is the C# code:
using System.Windows;
using System.Windows.Controls;
using Infragistics.Controls.Interactions;
namespace TestInfragisticsDialogWindow
{
public partial class MainPage : UserControl
public MainPage()
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
XamDialogWindow window = null;
// if the window exists don't create a new one
foreach (UIElement elem in grid1.Children)
if (elem.GetType() == typeof(XamDialogWindow))
window = elem as XamDialogWindow;
if (window != null)
window.Visibility = System.Windows.Visibility.Visible;
if (window == null)
// it doesn't exist so create a new one
window = new XamDialogWindow();
window.Content = "MyWindow";
grid1.Children.Add(window);
window.Maximize();
window.RestrictInContainer = true;
I also have been looking into this issue and am also unable to replicate this behavior. Would you be so kind as to attach a small code snippet or project reproducing it.
Thanks in advance.