Using DragDockPanelHost in WPF?

Aug 11, 2011 at 1:14 PM
Edited Aug 11, 2011 at 1:14 PM

Hi,

I'm trying to use the DragDockPanelHost in WPF. I've copied the neccesary files to my WPF project (until there where no more compile error).

 

 

<Window x:Class="Dashboard.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:blacklight="clr-namespace:Blacklight.Controls"
        xmlns:dashboard="clr-namespace:Dashboard"
        Title="MainWindow" Height="350" Width="800" Background="#f4f4f4">
   
    
    <Grid>
        <blacklight:DragDockPanelHost MaxColumns="2" MaxRows="2">
            <blacklight:DragDockPanel>
                <Border BorderBrush="Red" BorderThickness="1">
                    <TextBlock Text="Test" FontSize="20" />
                </Border>
            </blacklight:DragDockPanel>
        </blacklight:DragDockPanelHost>
    </Grid>
</Window>

I would expect that the above code would at least show something, but it doesn't. Any ideas?
Coordinator
Aug 11, 2011 at 3:36 PM
Edited Aug 11, 2011 at 3:41 PM

Hello Robbert,

 Looks like WPF support was dropped from the project a while back.

 I’m looking into adding it back.

 Can see that it doesn’t call

protected override void PrepareContainerForItemOverride(DependencyObject element, object item)

 

which adds the items to the collection of panels.

 

I’ll have a deeper look,

 

Regards,

Jasim Schluter

Blender3DLive

 

 

 

 

Aug 15, 2011 at 9:49 AM

Hi Jasim,

Thanks, I'm looking forward for WPF support for the DragDockPanelHost

Best regards,

Robbert

Oct 27, 2011 at 3:05 PM

Could you please tell me if I can use the control in WPF? I saw the demo in Silverlight and in my tests all I get is "empty" DragDock hosts. I really want an answer. Paid answers if you need!

Jan 16, 2012 at 2:25 PM

Not sure if this is a solution but maybe it will help:

it seems that a Template needs to be added to the DragDockPanelHost Style (I added one with an empty ControlTemplate) and now PrepareContainerForItemOverride gets called.

Greetings,

Jeroen

Jan 16, 2012 at 8:47 PM
Edited Jan 16, 2012 at 8:51 PM
thurbo wrote:

Not sure if this is a solution but maybe it will help:

it seems that a Template needs to be added to the DragDockPanelHost Style (I added one with an empty ControlTemplate) and now PrepareContainerForItemOverride gets called.

Greetings,

Jeroen


Correction:

The ControlTemplate should contain an ItemsPresenter. So with the new property the Style would look like this:

    <Style TargetType="local:DragDockPanelHost">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <Canvas />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:DragDockPanelHost">
                    <ItemsPresenter/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



Now the sample UserControl (DragDockPanelSample) does show the panels in an WPF application. Unfortunately, drag & drop does not seem to work flawless...

Jeroen

Coordinator
Jan 17, 2012 at 1:02 AM

Thanks Jeroen,

I've added that fix to the current release,

http://blacklight.codeplex.com/SourceControl/changeset/changes/8185

Feb 19, 2012 at 9:33 PM
thurbo wrote:
thurbo wrote:

Not sure if this is a solution but maybe it will help:

it seems that a Template needs to be added to the DragDockPanelHost Style (I added one with an empty ControlTemplate) and now PrepareContainerForItemOverride gets called.

Greetings,

Jeroen


Correction:

The ControlTemplate should contain an ItemsPresenter. So with the new property the Style would look like this:

    <Style TargetType="local:DragDockPanelHost">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <Canvas />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:DragDockPanelHost">
                    <ItemsPresenter/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



Now the sample UserControl (DragDockPanelSample) does show the panels in an WPF application. Unfortunately, drag & drop does not seem to work flawless...

Jeroen

Hi Jeroen, thank you so much for the fix. Have you been able to find a fix for the new flaws? I saw when dragging a panel for the first time everything seems great but when you want to drag another pannel after that, then it doens't seem to drag the panel anymore...

Coordinator
Feb 22, 2012 at 12:30 AM

Try the latest,

 

The Storyboards are breaking the dragging.

 

I have commented them out for now.

Feb 22, 2012 at 6:06 AM

Thanks Blender,

Working great!  If I have time i'll check if I can get the animations going again, but for now this is great.

Mar 8, 2012 at 8:38 PM
Blender3DLive wrote:

Try the latest,

 

The Storyboards are breaking the dragging.

 

I have commented them out for now.

Hi Blender 

Please let me know the next release with animation, 

Thanks in Advance

Mar 21, 2012 at 10:50 AM

Hi Blender,

when can I get a version of the DragDrogPanelHost supporting WPF? The download area is empty right now...

Thanks for your help!

Mar 21, 2012 at 10:28 PM
claudi27 wrote:

Hi Blender,

when can I get a version of the DragDrogPanelHost supporting WPF? The download area is empty right now...

Thanks for your help!

Check the source code area

Mar 29, 2012 at 5:30 AM
Edited Mar 29, 2012 at 5:30 AM

Hi,

Blender - thank you for these controls, they are excellent. I may have fixed the animation in WPF DragDropPanelHost:

Insert in AnimatedHeaderedContentControl.cs at line 144:

 

positionXAnimation.FillBehavior = FillBehavior.Stop;
positionYAnimation.FillBehavior = FillBehavior.Stop;
widthAnimation.FillBehavior = FillBehavior.Stop;
heightAnimation.FillBehavior = FillBehavior.Stop;

 

Curious to know if this fixes for you also, please let me know!

Mar 29, 2012 at 10:45 AM
Yratelev wrote:

Hi,

Blender - thank you for these controls, they are excellent. I may have fixed the animation in WPF DragDropPanelHost:

Insert in AnimatedHeaderedContentControl.cs at line 144:

 

positionXAnimation.FillBehavior = FillBehavior.Stop;
positionYAnimation.FillBehavior = FillBehavior.Stop;
widthAnimation.FillBehavior = FillBehavior.Stop;
heightAnimation.FillBehavior = FillBehavior.Stop;

 

Curious to know if this fixes for you also, please let me know!

Hi,

I can confirm that these changes work for me.

Thanks!

Jeroen

Apr 19, 2012 at 4:06 PM

Hi,

Just to bring another confirmation backup...,
I've already used Blacklight in several Silverlight applications, though encountered same issues with WPF...

I have downloaded the updated 8185 version and added the suggested WPF code section modifications
[Insert in AnimatedHeaderedContentControl.cs at line 144:...]

I can confirm that these changes also worked pretty well for me in WPF. Much appreciated ;)

Thank's 

Denys C.