Frage

I have a datagrid defined in xaml as follow:

  <DataGrid x:Name="ProcessInputImages" 
              ScrollViewer.HorizontalScrollBarVisibility="Hidden" RowHeaderWidth="0" AutoGenerateColumns="False" IsReadOnly="True"  SelectionMode="Single" SelectionUnit="Cell"
              IsHitTestVisible="True"  AllowDrop="True" cal:Message.Attach="[Event Drop] = [Action ObjectDropped($eventargs)" >

....
 </DataGrid>

and in my code behind, I have:

   public void ObjectDropped(DragEventArgs e)
    {

    }

But the event is not firing when I drop a directory from explorer into it.

Why it is not firing?

War es hilfreich?

Lösung

The problem was that xaml was wrong:

the correct syntax is:

 <DataGrid x:Name="ProcessInputImages" 
          ScrollViewer.HorizontalScrollBarVisibility="Hidden" RowHeaderWidth="0" AutoGenerateColumns="False" IsReadOnly="True"  SelectionMode="Single" SelectionUnit="Cell"
          IsHitTestVisible="True"  AllowDrop="True" cal:Message.Attach="[Event Drop] = [Action ObjectDropped($eventargs)]" >

....

note ] at the end of cal:Message.Attach="[Event Drop] = [Action ObjectDropped($eventargs)] which was missing.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top