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