Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
405
How do I specify a blank area to drop to in a StackPanel??
posted

I want to have a stackpanel where I can drop items to that has a big blank space with "Drop here" in it.   When I use a stackpanel, I cannot drop to it since there are no items in it.  I want to add items to the stackpanel as I drop.  The best I can do is as follows, but the problem is I must drop onto the textbox for it to pick it up, and then it adds my dropped items after that textbox.  What am I doing wrong?

 

  <StackPanel Height="400" Name="DropHere" x:FieldModifier="public" Grid.Column="1">

                        <TextBox Text="Drop Here" Grid.Column="1"/>

                        <ig:DragDropManager.DropTarget>

                                <ig:DropTarget IsDropTarget="True" DropChannels="ChannelColumns"/>

                            </ig:DragDropManager.DropTarget>

                        </StackPanel>

Parents
No Data
Reply
  • 8831
    posted

    Hi,

    You can try to wrap your StackPanel  with Grid and attach the DropTaget to it. The grid will cover the whole empty area so you can drop within easily. Then add you elements to your stack panel.

     

    StackPanel panel = (StackPanel)grid.Children[0];

     

    Regards.

    Plamen.

     

Children