Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top