Problem with Message.Attach & Datagrid

Topics: Bugs
Jan 8, 2013 at 1:37 PM


I have a strange problem with the WPF datagrid, Message.Attach and the AutoGeneratedColumns event:

My datagrid looks like this:

  <DataGrid Grid.Row="1" AlternationCount="2" AutoGenerateColumns="True" CanUserAddRows="True" CanUserDeleteRows="True" ColumnWidth="100" cal:Message.Attach="[Event AutoGeneratedColumns] = [Action AutoGeneratedColumns($source)]" ItemsSource="{Binding Points}" VerticalAlignment="Stretch" SelectedItem="{Binding SelectedItem}">

and in my viewmodel I have this method:

public void AutoGeneratedColumns(object sender)

The strange thing is that the target method in my viewmodel is only invoked if I show the view in a dialog (by windowmanager.showdialog).

If I use the view as part of an user control e.g. as a tab item, the target method is not invoked. All other actions of this view are invoked properly.

If I create an event handler in code behind, the handler is invoked in both cases.

Can anybody give me a hint what I'm doing wrong?