Проблема перетаскивания Silverlight ToolKit

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

<telerikDocking:RadPane x:Class="Module_TestModule1.PaneSzD" telerikDocking:RadDocking.SerializationTag="Module_TestModule1.PaneSzD"
    xmlns:telerikDocking="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"                             
    xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"                        
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="PaneSzD1" Header="PaneSzD" IsHidden="True">
<StackPanel Orientation="Horizontal">
    <Grid x:Name="LeftGrid" Width="250">
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <toolkit:ListBoxDragDropTarget AllowDrop="True" Grid.Row="0">
            <ListBox Name="lbLRecords">
            <ItemsPanelTemplate>
                <StackPanel Orientation="Vertical" />
            </ItemsPanelTemplate>
        </ListBox>
        </toolkit:ListBoxDragDropTarget>
        <StackPanel Grid.Row="1" Height="Auto">
            <TextBox Name="tbLRecord" KeyDown="tbLRecord_KeyDown" />
            <Button Name="btnLAddRecord" Content="Add Record" Height="30" Click="btnLAddRecord_Click" ></Button>
        </StackPanel>
    </Grid>
    <StackPanel Orientation="Vertical">
        <Button Name="btnLMoveRecord" Content="Move Record From Left" Height="30" Click="btnLMoveRecord_Click" Margin="10,5,10,5" />
        <Button Name="btnRMoveRecord" Content="Move Record From Right" Height="30" Click="btnRMoveRecord_Click" Margin="10,5,10,5" />
    </StackPanel>
    <Grid x:Name="RightGrid" Width="250">
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <toolkit:ListBoxDragDropTarget AllowDrop="True" Grid.Row="0">
            <ListBox Name="lbRRecords">
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Vertical" />
                </ItemsPanelTemplate>
            </ListBox>
        </toolkit:ListBoxDragDropTarget>
        <StackPanel Grid.Row="1" Height="Auto">
            <TextBox Name="tbRRecord" KeyDown="tbRRecord_KeyDown" />
            <Button Name="btnRAddRecord" Content="Add Record" Height="30" Click="btnRAddRecord_Click"></Button>
        </StackPanel>
    </Grid>
    </StackPanel>
</telerikDocking:RadPane>

Спасибо за любую помощь!


person nosferat    schedule 22.07.2010    source источник


Ответы (1)


Всю информацию о том, как это сделать с помощью Silverlight Control Toolkit, можно найти здесь: http://themechanicalbride.blogspot.com/2009/08/new-with-silverlight-toolkit-drag-and.html

person xanadont    schedule 21.09.2010