1

我试图找出是否有可能实现一个弹出的面板,其中包含鼠标悬停在“扩展器”位上的数据网格。

寻找与 Visual Studio 中的工具箱类似的东西。

我在搜索时遇到了重大问题,因为我不确定它叫什么。

如果我需要更好地解释自己,请告诉我。

4

2 回答 2

1

您可以使用AvalonDock来实现这一点

在此处输入图像描述

这是在 XAML 中使用以下代码完成的:

<avalondock:DockingManager x:Name="dockingManager">
    <avalondock:LayoutRoot>
        <avalondock:LayoutRoot.LeftSide>
            <avalondock:LayoutAnchorSide>
                <avalondock:LayoutAnchorGroup>
                    <avalondock:LayoutAnchorable Title="Autohidden Content">
                        <DataGrid>
                            <DataGrid.Columns>
                                <DataGridTextColumn Binding="{x:Null}" ClipboardContentBinding="{x:Null}" Header="Col1"/>
                                <DataGridTextColumn Binding="{x:Null}" ClipboardContentBinding="{x:Null}" Header="Col2"/>
                                <DataGridTextColumn Binding="{x:Null}" ClipboardContentBinding="{x:Null}" Header="Col3"/>
                            </DataGrid.Columns>
                        </DataGrid>
                    </avalondock:LayoutAnchorable>
                </avalondock:LayoutAnchorGroup>
            </avalondock:LayoutAnchorSide>
        </avalondock:LayoutRoot.LeftSide>
    </avalondock:LayoutRoot>
</avalondock:DockingManager>
于 2012-09-05T14:00:45.333 回答
0

I would facilitate WPF animations to realize any kind of menu that pops up / appears / slides in / come somehow into action smoothly.

Build your menu-control in any way you want e.g. based on a StackPanel and then assign some custom animations to its position properties to make it appear and disappear.

The use of animations is quite simple since you are only specifying for a particular property a begin value, a target value and way to do the transition between those two.

For example to make a Stackpanel grow and shrink you may do the following:

// suppose you have a stackpanel named sp.

// create the actual animation
DoubleAnimation myDoubleAnimation = new DoubleAnimation();
myDoubleAnimation.From = 100;
myDoubleAnimation.To = 300;
myDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(5));

// cerate the storyboard which comprise all your single animations into a compound animation - a storyboard.
StoryBoard myStoryboard = new Storyboard();
myStoryboard.Children.Add(myDoubleAnimation);

// link the animation with the object it is supposed to work on
Storyboard.SetTargetName(myDoubleAnimation, sp.Name);

// specify the target property of ypur StackPanel which should be affected by the animation
Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath(Rectangle.Width));

For a complete introduction you may start reading here: http://msdn.microsoft.com/en-us/library/ms752312.aspx

Also read about Easing functions since with their help you can build much more sophisticated animations.

于 2012-09-05T13:50:45.027 回答