How do I pop up XamDialogWindow from XamRibbonWindow?
Thanks in advance.
I found a workaround. The window content can be a Grid with the XamDialogWindow and the RibbonWindowContentHost as children:
<Grid Name="grid"> <Ribbon:RibbonWindowContentHost> <Ribbon:RibbonWindowContentHost.Ribbon> <Ribbon:XamRibbon> <!-- ... --> </Ribbon:XamRibbon> </Ribbon:RibbonWindowContentHost.Ribbon> <DockManager:XamDockManager> <DockManager:DocumentContentHost /> </DockManager:XamDockManager> </Ribbon:RibbonWindowContentHost> </Grid>
The code behind that I posted above would place the dialog window correctly. However, the layout would be slightly off:
Once that issue is fixed (and support for themes is added), XamDialogWindow will finally be usable.
Thank you.
The problem lies with the need to add the XamDialogWindow as a child of the XamRibbonWindow.
Your code assumes it has been added somewhere in XAML. However, in order to add it on the fly, one needs to have e.g. a Grid as the content of the RibbonWindowContentHost. The correct code would look like:
private void ButtonTool_Click(object sender, RoutedEventArgs e) { var myDialogWindow = new Infragistics.Controls.Interactions.XamDialogWindow { Width = 200, Height = 200, IsModal = true, Content = "This is a sample dialog window", }; grid.Children.Add(myDialogWindow); myDialogWindow.Show(); }
But what if the content is a XamDockManager?
HI,
You could wire up a button click event from your ribbon.
Here are some code snippets to show and hide the XamDialogWindow
private void ButtonTool_Click(object sender, RoutedEventArgs e)
{
xamDialogWindow1.Show(); //show the window
}
private void ButtonTool_Click_1(object sender, RoutedEventArgs e)
xamDialogWindow1.WindowState = Infragistics.Controls.Interactions.
WindowState.Hidden; //hide it
private void ButtonTool_Click_2(object sender, RoutedEventArgs e)
WindowState.Normal; //show it
Sincerely, Matt Developer Support Engineer