Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
35
Data disappearing from cells when scrolling through XamDataGrid
posted

Hi Team,

We have a Xamdatagrid with around 20 columns which are editable and virtualization is enabled on the grid , we are able to load and edit the data without any issues .

But when we use the grid’s scrollbar to view the records , the data from some of the columns (specifically columns which use XamMultiColumnCombo)  are disappearing as we scroll .

We have tried to set the RecordContainerGenerationMode to lazyload or preload which solves the issue , but has significant performance impact .So we can't go with this solution.

This is happening specifically on the cells which use XamMultiColumnCombo editor , the selected item is getting triggered on the combo when we use the scrollbar on the xamdatagrid. 

Any help to resolve this issue is greatly appreciated.

Current version of IG : 14.1

Here is the snippet of the column in which we are noticing the above issue,

<dataPresenter:UnboundField Label="Order Placer" Visibility="{Binding Source={StaticResource Proxy}, Path=Data.ShowCol, Converter={StaticResource BoolToCollapseVisibilityConverter}}">
<dataPresenter:Field.Settings>
<dataPresenter:FieldSettings AllowEdit="True" LabelTextAlignment="Center" LabelTextWrapping="Wrap" Width="140"
CellValuePresenterStyle="{StaticResource EditableCellValuePresenterStyle}">

<dataPresenter:FieldSettings.EditorStyle>
<Style TargetType="{x:Type editors:XamTextEditor}">

<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type editors:XamTextEditor}">
<Grid IsEnabled="{Binding DataItem.IsEnabled}">

<StackPanel DataContext="{Binding DataItem.DsViewModel}">
<ig:XamMultiColumnComboEditor
x:Name="TestCombo"
AutoGenerateColumns="False"
DropDownButtonDisplayMode="Always"
SelectedItemsResetButtonVisibility="Collapsed"
ItemsSource="{Binding Orders}"
DisplayMemberPath="Name"
SelectedItem="{Binding SelectedOrder, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
FilterMode="FilterOnAllColumns"
MinDropDownWidth="320"
>
<ig:XamMultiColumnComboEditor.Columns>
<ig:TextComboColumn Key="Name"/>

</ig:XamMultiColumnComboEditor.Columns>
</ig:XamMultiColumnComboEditor>
</StackPanel>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="EditTemplate">
<Setter.Value>
<ControlTemplate TargetType="{x:Type editors:XamTextEditor}">
<Grid IsEnabled="{Binding DataItem.IsEnabled}">
<StackPanel DataContext="{Binding DataItem.DsViewModel}">
<ig:XamMultiColumnComboEditor
x:Name="OrderPlacerCombo"
AutoGenerateColumns="False"
DropDownButtonDisplayMode="Always"
SelectedItemsResetButtonVisibility="Collapsed"
ItemsSource="{Binding Orders}"
DisplayMemberPath="Name"
SelectedItem="{Binding SelectedOrder, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
FilterMode="FilterOnAllColumns"
MinDropDownWidth="320"
>
<ig:XamMultiColumnComboEditor.Columns>
<ig:TextComboColumn Key="Name"/>

</ig:XamMultiColumnComboEditor.Columns>
</ig:XamMultiColumnComboEditor>
</StackPanel>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</dataPresenter:FieldSettings.EditorStyle>
</dataPresenter:FieldSettings>
</dataPresenter:Field.Settings>
</dataPresenter:UnboundField>

Parents
  • 30330
    Offline posted

    Hello Curious WPF,

    I have been investigating into the behavior you are seeing, and I believe the behavior you are seeing could be due to the cells that belong to the UnboundField not having a Value, which is where the XamTextEditor that you are re-templating would pull its value from, and this could be having an effect on the XamMultiColumnComboEditor that you have placed in its template. As such, I would recommend that you ensure that the Cell.Value of the cells belonging to your UnboundField have a Value. You can do this by looping through the Records collection of the XamDataGrid and checking the Cells[<yourFieldIndex>].Value.

    It is also worth noting that I can see that you are only using a single column in the XamMultiColumnComboEditor and as such, I am wondering if the built-in XamComboEditor that exists in the same assembly as the XamTextEditor would work better for you in this case? The “WPF-specific” XamComboEditor was built to be used as an editor in the XamDataGrid, and you can use it simply by writing an EditorStyle for XamComboEditor for your UnboundField. This type of editor will also automatically resolve the Cell.Value to a value within the editor, making it much easier to use.

    Please let me know if you have any other questions or concerns on this matter.

Reply Children