This project is read-only.

Restrict actions on panels

Jun 3, 2008 at 10:00 PM
Hi,
I'm working on integrating AvalonDock with my application, and thus far it looks awesome.  Thanks for the great application!  I had a couple of questions though.  Firstly, is there any usage documentation anywhere?  I've just been looking at the sample, but some real documentation would be great. 

In my application rather than having a tabgroup of documents, I have one single "document" which can never be closed.  Is there a way hide the tab group header and the closing x for the document?   I just want to be able to have panels around the outside of this single document that can be moved around, tabbed, etc. 

If this functionality isn't there already, could you point me towards a starting place to add it?  Maybe be extending from one of the document classes?

Thanks!
Jun 4, 2008 at 9:19 AM
Edited Jun 4, 2008 at 9:20 AM

Thank you timekeepr9, sorry but documentation is not available at the moment, but I added this as proposed task in the issue tracker so you can see when will be included in a release.

To have a single document never closable you can take advantage of WPF styles. Restyle the DocumentPane control with xaml code like this:
(the animation serves only to show the pane smoothly). Put this style in a resource dictionary and merge it when your application starts.



<
Style TargetType="{x:Type ad:DocumentPane}">

 

 

 

<Setter Property="Template">

 

 

 

<Setter.Value>

 

 

 

<ControlTemplate TargetType="{x:Type ad:DocumentPane}" >

 

 

 

<ContentPresenter

 

 

 

Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Content}"

 

 

 

Margin="2"

 

 

 

KeyboardNavigation.TabNavigation="Local"

 

 

 

KeyboardNavigation.DirectionalNavigation="Contained"

 

 

 

KeyboardNavigation.TabIndex="1"

 

 

 

/>


<ControlTemplate.Triggers>

 

 

 

<EventTrigger RoutedEvent="Window.Loaded">

 

 

 

<BeginStoryboard>

 

 

 

<Storyboard>

 

 

 

<DoubleAnimation

 

 

 

Storyboard.TargetProperty="Opacity"

 

 

 

From="0" To="1" Duration="0:0:0.200" />

 

 

 

</Storyboard>

 

 

 

</BeginStoryboard>

 

 

 

</EventTrigger>

 

 

 

</ControlTemplate.Triggers>

 

 

 

</ControlTemplate>

 

 

 

</Setter.Value>

 

 

 

</Setter>

 

 

 

</Style>

 

 

Jun 5, 2008 at 1:33 AM
That worked perfectly, thanks!

I was also hoping to restyle some of the other components, mostly just change colors to match our color scheme.  I thought a good starting point would be to grab a copy of your default template and start editing from there.  However, your default template seems to reference some internal classes (in particular its complaining that the DockablePane style references a DockableTabPanel, which is internal).  Is there some reason these classes need to be internal, or could you make them public so they could be restyled?
Jun 5, 2008 at 10:28 AM
No reason to keep these classes internal, so feel free to make them public and I will do that in next release. I usually follow MS security directives that suggest to make public only classes explicitly designed to be public. In WPF at the moment this can't be done due to restyling:)