add documentContent from userControl

Jun 15, 2011 at 9:54 PM

hi,

I have a problem when add a new documentcontent in dockingmanager from usercontrol my dockingmanager don´t show the new documentcontent

i´m  using in my mainwindow this code 

          var doc = new DocumentCatalogoSocio(){ Title = "catalog" };

 doc.Show(dockManager);

         doc.Activate();

and i don´t have problem for see this document, i use the same code in my usercontrol and i don't see the document
any idea why this happens?
thank george

Jun 22, 2011 at 2:49 PM

you need to set ur xaml to something like this 

<ad:DockingManager Name="dockingManager" Margin="0,0,0,0" Grid.Row="2" Grid.Column="0" >
            <ad:ResizingPanel Orientation="Vertical">
                <ad:DocumentPane>
                 
                </ad:DocumentPane>
            </ad:ResizingPanel>
        </ad:DockingManager>

Dec 22, 2011 at 6:44 AM

Hello raym0nd,

I'm Having same issue. Can you help me to solve.

I need in button click event. When the user click the button, the document content have to add from the user control.

//My Usercontrol XAML:

<ad:DockingManager x:Class="AvalonDockSampleProject.UserControl1"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
       
    <Grid>
        <DataGrid AutoGenerateColumns="False" Height="91" HorizontalAlignment="Left" Margin="18,67,0,0" Name="dataGrid1" VerticalAlignment="Top" Width="264" />
    </Grid>
</ad:DockingManager>

//UserControl Code-behind:

namespace AvalonDockSampleProject
{
    /// <summary>
    /// Interaction logic for UserControl1.xaml
    /// </summary>
    public partial class UserControl1 : AvalonDock.DockingManager
    {
        public UserControl1()
        {
            InitializeComponent();
        }
    }
}

Main Window Code :

//My Main Window XAML:
<Window x:Class="AvalonDockSampleProject.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="24"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="24"/>
        </Grid.RowDefinitions>
        
        <ad:DockingManager x:Name="dockManager" Grid.Row="1">
            <ad:ResizingPanel Orientation="Vertical">
                <ad:ResizingPanel Orientation="Horizontal">
                    <ad:DocumentPane>
                        <ad:DocumentContent Title="Medium Recipe!">
                            <DataGrid/>
                        </ad:DocumentContent>
                        <ad:DocumentContent Title="Vitamin!">
                            <DataGrid/>
                        </ad:DocumentContent>
                    </ad:DocumentPane>
                </ad:ResizingPanel>
            </ad:ResizingPanel>
        </ad:DockingManager>
	<Button Content="Button" Height="32" Name="button1" Width="82" />
    </Grid>
</Window>

//Main Window Code-behind:
private void button1_Click(object sender, RoutedEventArgs e)
        {
	//when i click this button, i want to add documentcontent from the usercontrol.
	//how to make it.
        }

 

Thanks,

thenndral