Edited row jumps at the end of the group in the datagrid

Jun 10, 2009 at 3:37 PM

Hello,

I've downloaded example for listview from http://download.microsoft.com/download/4/D/D/4DDC73C4-50A1-4679-8D2D-FE85538BEE0C/wpf_samples/GridViewWithGroups.exe
and replaced listview with DataGrid: and added column
 <wpf:DataGridTextColumn Binding="{Binding XPath=@Price}"></wpf:DataGridTextColumn>

Now if I'm double click on editable cell in first or second row and click then to any other cell - edited row jumps at the end of the group list.
Is there a way to leave row at the position before editing?

Is this a known bug or I have to change something more?

Code is below.

 

Can anyone help me to fix this?

 

Thank you.

 

<Window xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
            xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
            xmlns:wpf="http://schemas.microsoft.com/wpf/2008/toolkit"
            >
  <Window.Resources>
    <XmlDataProvider x:Key="MyData" XPath="/Info">
      <x:XData>
        <Info xmlns="">
          <Item ID="12345" Name="Book 1" Price="$32.05"
                Author="Author A" Catalog="Business"/>
          <Item ID="13590" Name="Book 2" Price="$10.00"
                Author="Author B" Catalog="Language"/>
          <Item ID="24678" Name="Book 3" Price="$9.00"
                Author="Author C" Catalog="Language"/>
          <Item ID="65432" Name="Book 4" Price="$8.50"
                Author="Author D" Catalog="Business"/>
          <Item ID="11233" Name="Book 5" Price="$19.00"
                Author="Author E" Catalog="Health"/>
          <Item ID="94837" Name="Book 6" Price="$8.50"
                Author="Author F" Catalog="Language"/>
        </Info>
      </x:XData>
    </XmlDataProvider>
   <CollectionViewSource x:Key='src'
                          Source="{Binding Source={StaticResource MyData},
                                   XPath=Item}">
      <CollectionViewSource.GroupDescriptions>
        <PropertyGroupDescription PropertyName="@Catalog" />
      </CollectionViewSource.GroupDescriptions>
    </CollectionViewSource>
  </Window.Resources>
  <wpf:DataGrid ItemsSource='{Binding Source={StaticResource src}}'
                  AutoGenerateColumns="False"
            BorderThickness="0">
        <wpf:DataGrid.GroupStyle>
            <GroupStyle>
                <GroupStyle.ContainerStyle>
                    <Style TargetType="{x:Type GroupItem}">
                        <Setter Property="Margin" Value="0,0,0,5"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type GroupItem}">
                                    <Expander IsExpanded="True" BorderBrush="#FFA4B97F"
                            BorderThickness="0,0,0,1">
                                        <Expander.Header>
                                            <DockPanel>
                                                <TextBlock FontWeight="Bold" Text="{Binding Path=Name}"
                                   Margin="5,0,0,0" Width="100"/>
                                                <TextBlock FontWeight="Bold"
                                   Text="{Binding Path=ItemCount}"/>
                                            </DockPanel>
                                        </Expander.Header>
                                        <Expander.Content>
                                            <ItemsPresenter />
                                        </Expander.Content>
                                    </Expander>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </GroupStyle.ContainerStyle>
            </GroupStyle>
        </wpf:DataGrid.GroupStyle>
        <wpf:DataGrid.Columns>
            <wpf:DataGridTextColumn Binding="{Binding XPath=@Price}"></wpf:DataGridTextColumn>
        </wpf:DataGrid.Columns>
   </wpf:DataGrid>
</Window>