2011-08-31 4 views
2

내 Excel AddIn에서 WPF 창이 있습니다. 윈도우 안에는 상단 부분에 DataGrid (DataGrid1이라고 함)가있는 usercontrol이 있습니다. 창의 아래 부분에는 DataGrid를 포함하는 또 다른 usercontrol이 있습니다 (DataGrid2라고 함). 나는 전혀 트리거되지 않습니다DataGrid (WPF)에서 드래그 앤 드롭이 작동하지 않습니다.

<toolkit:DataGrid 
       Style="{StaticResource DataGridStyle}" 
       SelectionMode="Extended" 
       ItemsSource="{Binding Relations}" 
       SelectedItem="{Binding ListSelection}" 
       MouseDoubleClick="dg_MouseDoubleClick" 
       DragEnter="DataGrid_CheckDropTarget" 
       DragLeave="DataGrid_CheckDropTarget" 
       DragOver="DataGrid_CheckDropTarget" 
       PreviewMouseLeftButtonDown="DG_PreviewMouseLeftButtonDown" 
        ContextMenuOpening="dg_ContextMenuOpening" 
       PreviewMouseMove="DG_MouseMove" BorderBrush="LightGray"> 

datagrid2

<dg:DataGrid Grid.Row="1" x:Name="basketDG" Margin="5 0 5 0" Background="White" 
       AutoGenerateColumns="False" 
       Style="{StaticResource DataGridStyle}" 
       ItemsSource="{Binding MyItems, Mode=OneWay}" 
       SelectedItem="{Binding SelectedRelComplete}" 
       SelectionChanged="BasketDgSelectionChanged"     
       Drop="DataGridDrop" 
       DragEnter="DataGridDragEnter" 
      > 

    <Style x:Key="DataGridRowStyle" TargetType="{x:Type dg:DataGridRow}"> 
     <Setter Property="AllowDrop" Value="True" />   
    </Style> 
    <Style x:Key="DataGridStyle" TargetType="{x:Type dg:DataGrid}"> 
     <Setter Property="RowStyle" Value="{StaticResource DataGridRowStyle}" /> 
    </Style> 

하지만 (datagrid2에) 행사의 dragEnter를 들어, DataGrid1이 행을 드래그 DataGrid1이에 대한 datagrid2

에 드롭하고 싶다.

무엇이 여기에 있습니까? 마지막으로, 인터넷 검색과 투쟁의 일 후

답변

0

나는이 기본이 아닌 도메인에서 WPF 응용 프로그램을 실행할 때, 드래그 앤 드롭이 작동하지 않습니다 WPF의 버그 무언가

을 발견했다. https://connect.microsoft.com/VisualStudio/feedback/details/422485/drag-and-drop-does-not-work-when-executing-a-wpf-application-in-a-non-default-appdomain

감사에게 사무엘 잭의 문제를 해결하고 http://blog.functionalfun.net/2009/10/work-around-for-wpf-bug-drag-and-drop.html

@ 자신의 블로그 에서 해결 방법을 퍼팅을 많이 볼
관련 문제