DockableContent

Jul 16, 2009 at 4:29 AM

Hi,

I'm trying to display DockableContent based on the user's selection from a menu. 
I want to create a seperate xml/.cs class for a specific DockableContent.

Here is a similar discussion posted earlier on the forum on how to do this:

http://avalondock.codeplex.com/Thread/View.aspx?ThreadId=41900

 

 The problem is I cannot see any of the control I add to the Window created with VS, where I changed the base class from Window to DockableContent.

This is illustrated with the simple code below.

Can anyone help me on this?

 

Thanks,

Kamel

 

 

Here is the xaml:

 

<ad:DockableContent x:Class="Dockablecontent_AvalonDock.Window1"
    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="Window1" Height="300" Width="300">
    <Grid>
        <Button Height="23" HorizontalAlignment="Right" Margin="0,0,-85,-33" Name="button1" VerticalAlignment="Bottom" Width="75">Button</Button>
    </Grid>
</ad:DockableContent>

 

 

Here is the code:

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using AvalonDock;

namespace Dockablecontent_AvalonDock
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : DockableContent
    {
        public Window1()
        {
            InitializeComponent();
        }
    }
}

 

 

Jul 16, 2009 at 1:35 PM

Here is what I did...created a new class...

public partial class MyCustomContent : DockableContent

{

...

}

then in the Main Window I have:

<font size="2" color="#0000ff"><font size="2" color="#0000ff">

<

</font></font><font size="2" color="#0000ff">

 

</font>

myNameSpace:MyCustomContent Title="My name" x:Name="dcName" Visibility="False" IsEnabled="False" Height="200" ad:ResizingPanel.ResizeWidth="600"></myNameSpace:MyCustomContent >

On the Menu Click I show and hide the content.

Hope that helps,

 

Jul 16, 2009 at 3:21 PM

Hi,

If I try the following code and then drag a button from the toolbox, I have he following error message:

"The specified visual is not a descendant of this visual"

How can I edit the xaml code of a window which base class derive from DockableContent?

Thanks,

Kamel

 

Here is the Xaml:

<ad:DockableContent x:Class="Dockablecontent_AvalonDock.Window1"
    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="Window1" Height="300" Width="300">
    <Grid>
     
    </Grid>
</ad:DockableContent>

 

 

Here is the code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using AvalonDock;

namespace Dockablecontent_AvalonDock
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : DockableContent
    {
        public Window1()
        {
            InitializeComponent();
        }
    }
}