Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 666847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:51:50+00:00 2026-05-13T23:51:50+00:00

We’re trying to figure out how to drag an item from a LibraryStack container

  • 0

We’re trying to figure out how to drag an item from a LibraryStack container onto a ScatterView, like how the photo viewer sample applications work. Currently, the item just flies back into the LibraryStack after we drag it out. We can drag and drop items into other LibraryStacks or LibraryBars.

Here’s a sample of what we’re trying:

<s:SurfaceWindow x:Class="Idia_seminar.SurfaceWindow1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="http://schemas.microsoft.com/surface/2008"
Title="Idia_seminar"
>
<s:SurfaceWindow.Resources>
<ImageBrush x:Key="WindowBackground" Stretch="None" Opacity="0.6" ImageSource="pack://application:,,,/Resources/WindowBackground.jpg"/>
</s:SurfaceWindow.Resources>

<Grid Background="{StaticResource WindowBackground}" >
    <s:ScatterView Name="scatterView1" AllowDrop="True">
        <s:SurfaceButton Name="surfaceButton1">Button</s:SurfaceButton>
        <s:LibraryStack AllowDrop="True">
            <s:LibraryStackItem Content="hello"></s:LibraryStackItem>
        </s:LibraryStack>
    </s:ScatterView>
</Grid>
</s:SurfaceWindow>

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:51:50+00:00Added an answer on May 13, 2026 at 11:51 pm

    This is certainly doable. I cooked up an example that allows you to drag items from a librarybar located within a scatterview and drop items on the scatterview where they appear as new scatterviewitems.

    I’m not sure where you went wrong, but in order for drag/drop to work, the following has to happen:

    1. The drop target must have AllowDrop set to true
    2. The drop target must be visible to hit testing (usually accomplished by setting a background other than null – i use Transparent)
    3. The drop target must handle the Drop event and do something clever with the data

    Here’s my XAML:

    <s:ScatterView AllowDrop="True" Background="Transparent" 
            x:Name="scatterView" s:SurfaceDragDrop.Drop="scatterView_Drop">
        <s:SurfaceButton Name="surfaceButton1">Button</s:SurfaceButton>
            <s:LibraryStack>
                <s:LibraryStackItem Content="Hello"></s:LibraryStackItem>
            </s:LibraryStack>
        </s:ScatterView>
    </s:ScatterView>
    

    And in code, we handle the Drop event

    private void scatterView_Drop(object sender, SurfaceDragDropEventArgs e)
    {
        Console.WriteLine("Got drop: " + e.Cursor.Data);
        var newItem = new ScatterViewItem();
        // Rely on .ToString() on the data. A real app would do something more clever
        newItem.Content = e.Cursor.Data;
        // Place the new item at the drop location
        newItem.Center = e.Cursor.GetPosition(scatterView);
        // Add it to the scatterview
        scatterView.Items.Add(newItem);
    }
    

    Obviously, the code above doesn’t handle dragging items back to the librarybar. I leave that as an exercise to the reader 😉

    The following MSDN guide is something I definitely think you should read: http://msdn.microsoft.com/en-us/library/ee804812.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.