User-resizable WPF Controls?

Viewed 30822

In XAML, how do I make it possible to resize controls or portions of a display the way the different panels like the Toolbox, Solution Explorer or Error List in Visual Studio can be grabbed and resized?

In this made-up example . . .

<Window x:Class="UI_Experiments_1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <DockPanel x:Name="Tab3DockPanel" Background="#FFA0FFA0" LastChildFill="True">
        <ScrollViewer DockPanel.Dock="Left" Background="Lavender">
            <TextBlock Height="60" TextWrapping="Wrap" Background="#FFFFDDDD" Width="140">
                  ScrollViewer - DockPanel.Dock="Left"
            </TextBlock>
        </ScrollViewer> 
        <TextBlock DockPanel.Dock="Top" HorizontalAlignment="Center" 
               TextWrapping="Wrap" Background="LemonChiffon">
               DockPanel.Dock="Top" HorizontalAlignment="Center"
        </TextBlock>
        <ListBox DockPanel.Dock="Right" Background="#FFCCEEFF">
               ListBox DockPanel.Dock="Bottom" 
        </ListBox>
    </DockPanel>
</Window>

. . . I have a DockPanel with a ScrollView docked on the left, a ListBox docked on the bottom, and a TextBlock on the top. Is there a way to attach resizing handles to these to achieve the same effect, or is there some other control that these can be embedded in? As I said, the above is just a made-up example to experiment with - I don't care if I use those exact controls.

I did find an example of adding resizing handles using an Adorner on MSDN but it involved over 170 lines of C# code so before adopting that I wanted to be sure there was no intrinsic way to achieve this in XAML.

Thanks in advance.

2 Answers
Related