 |
|
 |
Excellent control, very useful, worked for me without modification. Thanks very much.
|
|
|
|
 |
|
|
 |
|
 |
Here's my scenario. I need a control with two "panes" that each bind to an IsVisible property. Both panes, only pane 1, only pane 2, or neither pane can be displayed. And I need the relative size of the panes to be adjustable (via a splitter drag action) by the user. The problem that I'm experiencing with the DockPanel control is that the DockPanel.Dock attached property doesn't have an explicit Fill state. And also the DockPanel has this weird behavior that even if the DockPanel only contains one non-collapsed UIElement (Visibility="Visible") and that element doesn't even have an explicitly set DockPanel.Dock attached property and the DockPanel's LastChildFill property is set to True, rather that expanding the non-collapsed UIElement to fill the DockPanel, it instead defaults to left-docking. Go figure! To be more clear, this behavior occurs when there exist additional collapsed elements beyond the one non-collapsed UIElement. Hence, when you collapse the second pane, the first pane doesn't expand to fill the DockPanel.
So I'm curious if there might be an easy way to tweak your control to achieve this behavior?
Many thanks!
|
|
|
|
 |
|
 |
Hi CDCii,
please create a small example application and we can see if we can get the dock panel splitter control to work correctly with it. The control is included in propertytools.codeplex.com, you can continue the discussion there. If the question is about DockPanel behaviour and not the DockPanelSplitter, a question on stack overflow may also be a good idea!
|
|
|
|
 |
|
 |
Painless and easy to implement. Does the job well.
|
|
|
|
 |
|
 |
any advice for creating support for this in silverlight?
|
|
|
|
 |
|
 |
Generally, while using grid-splitter we can restrict one splitter to move upto next/previous splitter. In other words, splitter moves in-between two rows/columns only. But here we can move splitter anywhere from left-to-right/top-to-bottom. Can we implement same restriction here?
|
|
|
|
 |
|
 |
When you resize the demo window down to a minimum and then up again, this exception is thrown:
System.ArgumentException was unhandled
Message="\"-4\" not valid for property \"Height\"."
Source="WindowsBase"
StackTrace:
bei System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal)
bei System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
bei System.Windows.FrameworkElement.set_Height(Double value)
bei OpenSourceControls.DockPanelSplitter.SetTargetHeight(Double newHeight) in DockPanelSplitterDemo\DockPanelSplitter\DockPanelSplitter.cs:Line 215.
|
|
|
|
 |
|
 |
thanks for the bug report! I cannot reproduce this in the demo application, but I understand there must be some problem in the SetTargetHeight/Width methods. I suggest you move the if statements just before the last line where the element's height is set. Please post back if this helps.
|
|
|
|
 |
|
 |
Hi,
I observe the same problem as kiol!
"Moving down the if statements" worked for me
Regards, H
Btw: Great work!!
|
|
|
|
 |
|
 |
I would like to use this cool tool in my code behind - but I can't get it to work.
It compiles and I can hit break points but I just can't "see" it.
If I use it in XAML, it works just fine.
Has anyone run into this or do I just suck
Thanks in advance,
Jason
|
|
|
|
 |
|
 |
OK, further testing - it is there. Just basically has zero width.
Mouse re-size cursor shows up and I can grab it and re-size the DockPanel.
Still stumped as to why it does not display using .cs file, but does putting it directly in XAML file.
|
|
|
|
 |
|
 |
hi Jason! the Thickness property should be used to change the width of the splitter. This should work both for horizontal and vertical splitters. Use the DockPanel.Dock property to set the orientation of the splitter. Let me know if there is a bug in the code, it seems to work here.
|
|
|
|
 |
|
 |
I did set both Thickness and DockPanel.Dock properties.
Works:
DockPanel dockPanel = (DockPanel) this.Parent;
DockPanelSplitter dps = new DockPanelSplitter();
dps.Thickness = 6;
dps.BorderThickness = 6; // Have to set for it to display
dps.Background = Brushes.AliceBlue; // Have to set for it to display
dps.BorderBrush = Brushes.CornflowerBlue; // Have to set for it to display
DockPanel.SetDock( dps, Dock.Left );
dockPanel.Children.Add( dps );
But this displays correctly in the XAML file:
...
<DockPanel Background="White" Name="MainDockPanel" Grid.Row="1" Margin="0,2,0,-2">
<TextBlock>Hello World</TextBlock>
<osc:DockPanelSplitter DockPanel.Dock="Left" Style="{StaticResource HorizontalBevelGrip}"/>
</DockPanel>
...
|
|
|
|
 |
|
 |
Could you update your DockPanelSplitterDemo project to include a code behind example?
Please?
Thanks so much for building such a helpful widget!
Jason
|
|
|
|
 |
|
 |
Fixed:
Window window = Window.GetWindow( this );
DockPanelSplitter dps = new DockPanelSplitter();
dps.Style = (Style) ( window.Resources[ "VerticalBevelGrip" ] );
|
|
|
|
 |
|
|
 |
|
 |
Thanks, objo, for writing this article: it's a really useful control and a nice demo to go with it.
I had one problem adding it to my own assembly so I thought I'd post the solution here for any other WPF-newbies using it.
I added the DLL to my own project and it worked but then I decided I needed to tweak it a bit so I added a Themes folder, putting generic.xaml into it and a Controls folder, putting DockPanelSplitter.cs into it. When I ran the app, the splitters didn't appear but there were no errors. I moved the mouse pointer over where the splitters should've been and it didn't change to the double-arrow. I discovered that I needed to add an attribute to AssemblyInfo.cs for it to work:
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly )]
Once I'd added this code, it worked.
|
|
|
|
 |
|
 |
Thanks for the message - and showing your solution! Yes, this is a UserControl and if you don't reference the assembly, you need to copy the template (generic.xaml) and add the ThemeInfo.
|
|
|
|
 |
|
 |
Manually set the Background, BorderBrush and BorderThickness in Generic.xaml file and boom - it shows up.
Why does the TemplateBinding not work in code behind?
|
|
|
|
 |
|
 |
sorry for confusing with UserControl, it should of course be custom control.
|
|
|
|
 |
|
|
 |
|
 |
thanks for the link! that's a good example of a user control! I like the adorner solution.
|
|
|
|
 |
|
 |
Failure by design:
You can move the splitter between green and red down out of the window and no chance to get it back. Will be hard to fix this.
|
|
|
|
 |
|
 |
Thanks for the bug message. Yes, this can be a problem for the user. It seems like also the GridSplitter control has the same problem. I added some code that constrains the size of the element being resized to the available client area - this solves the problem for the demo application, but not in general. It would be great to hear if you have some ideas how to solve this. Maybe it is neccessary to use the Measure/Arrange methods?
|
|
|
|
 |