Ошибка перетаскивания с элементами Scatterview и сеткой - PullRequest
1 голос
/ 26 марта 2012

Ссылка на изображение моего приложения

Я хочу определить, находятся ли 2 изображения на холсте рядом друг с другом, а затем провести некоторую операцию сравнения с данными, встроенными вфотографии, если они касаются друг друга.

Коричневая область - это ScatterView, куда я могу перетаскивать элементы изображения и добавлять их в зеленый список.

Я могу перетаскивать элементы изображения непосредственно изсинее поле со списком коричневой области выпадения.

Но когда я сначала отбрасываю их в желтое представление рассеяния, я не могу выйти оттуда, чтобы бросить их в коричневое представление рассеяния.

<Grid ShowGridLines="True">
<Grid.RowDefinitions >
  <RowDefinition Height="*" />
  <RowDefinition Height="Auto" />

</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
    <ColumnDefinition></ColumnDefinition>
    <ColumnDefinition></ColumnDefinition>
    <ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>


    <s:ScatterView 
        Grid.Row="0" 
        Grid.Column="0" 
        Grid.ColumnSpan="2" 
        Grid.RowSpan="1" 
        x:Name="ScatterLayer" 
        Background="Yellow" 
        ItemContainerStyle="{StaticResource ScatterItemStyle}" 
        AllowDrop="True"
        ItemTemplate="{StaticResource ImageAndCaptionTemplate}"
        ItemsSource="{Binding ScatterItems}" 
        s:SurfaceDragDrop.Drop="ScatterLayer_Drop" 
        s:SurfaceDragDrop.DragEnter="ScatterLayer_DragEnter" 
        s:SurfaceDragDrop.DragCompleted="ScatterLayer_DragCompleted" >
    </s:ScatterView>

    <s:SurfaceListBox 
        Grid.Row="0" Grid.Column="2"
        AllowDrop="True"
        x:Name="ListBoxVerticalBasket"
        VerticalAlignment="Top"
        Background="GreenYellow"
        ItemsSource="{Binding Path=BasketItems}"
        ItemTemplate="{StaticResource BasketTemplate}" >
        <s:SurfaceListBox.ItemsPanel>
            <ItemsPanelTemplate>
                <StackPanel Orientation="Vertical" />
            </ItemsPanelTemplate>
        </s:SurfaceListBox.ItemsPanel>
    </s:SurfaceListBox>

    <s:SurfaceListBox 
        Grid.Row="1" 
        Grid.Column="0" 
        Grid.ColumnSpan="2" 
        x:Name="ShoppingList"
        AllowDrop="True" 
        s:SurfaceDragDrop.DragCompleted="OnShoppingListDragCompleted" 
        s:SurfaceDragDrop.DragCanceled="OnShoppingListDragCanceled" 
        PreviewMouseLeftButtonDown="OnShoppingListPreviewMouseLeftButtonDown" 
        PreviewMouseMove="OnShoppingListPreviewMouseMove" 
        PreviewMouseLeftButtonUp="OnShoppingListPreviewMouseLeftButtonUp" 
        ItemsSource="{Binding Path=LibraryItems}" 
        ItemTemplate="{StaticResource ImageAndCaptionTemplate}"
        PreviewTouchDown="OnShoppingListPreviewTouchDown" 
        PreviewTouchMove="OnShoppingListPreviewTouchMove" 
        PreviewTouchUp="OnShoppingListPreviewTouchUp" 
        Background="#FF00BDD8">
        <s:SurfaceListBox.ItemsPanel>
            <ItemsPanelTemplate>
                <StackPanel Orientation="Horizontal" AllowDrop="True"/>
            </ItemsPanelTemplate>
        </s:SurfaceListBox.ItemsPanel>

    </s:SurfaceListBox>

    <s:ScatterView 
        Grid.Column="2" 
        Grid.Row="1" 
        Background="DarkGoldenrod" 
        Width="300" 
        Height="100"
        x:Name="ScatterViewDropArea"
        VerticalAlignment="Top" 
        HorizontalAlignment="Left"
        AllowDrop="True"
        s:SurfaceDragDrop.Drop="ScatterViewDropArea_Drop">
    </s:ScatterView>

1 Ответ

0 голосов
/ 26 июня 2012

Я думаю, вам следует подумать об использовании DragDropScatterView, который идет с демонстрационной корзиной покупок в Surface SDK вместо ScatterView.

...