DataGrid like control but faster

WPF Studio, Themes, and Shared Library for WPF Forum

The latest build of this product (v24.1.1) was released 2 months ago, which was before this thread was created.
Posted 2 months ago by Daniel Constantin - ModuleWorks GmbH
Version: 24.1.1
Avatar

Hi!

I have an application in which I need to populate very often a data grid control and also scroll into view for the selected item(row). I do this like 10 times / second. I do not want to scroll row to row as this will be very slow.

The WPF DataGrid is pretty slow for my needs.

What actipro controls can I try to see if it is faster than the default WPF data grid?

Kind regards,

Daniel

Comments (7)

Posted 2 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Daniel,

At the moment, we don't have a custom DataGrid control in our library.  The closest thing would be TreeListView in the Grids product.  You can use that to create flat lists like a ListView appearance, and it is virtualized by default.  Our "Grids / TreeListView QuickStarts / Flat List" sample shows an example of displaying a flat list.  You could try testing with that sample.


Actipro Software Support

Posted 1 month ago by Daniel Constantin - ModuleWorks GmbH
Avatar

Hi!

I want to change the ControlTemplate for the DataGridCell but I do not know the colors for the selected cell.

          <Style x:Key="RightAlignmentDataGridCellStyle" TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource {x:Static themes:DataGridResourceKeys.DataGridCellStyleKey}}">
              <Setter Property="HorizontalContentAlignment" Value="Right"/>
              <Setter Property="MinWidth" Value="50"/>
              <Setter Property="Height" Value="24"/>
              <Setter Property="Template">
                  <Setter.Value>
                      <ControlTemplate TargetType="{x:Type DataGridCell}">
                          <TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content.Text}"
                                     VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                     HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
                      </ControlTemplate>
                  </Setter.Value>
              </Setter>

I also searched inside the styles folder but I could not found it. I am expecting some trigger on the IsSelected property which sets the background.

Kind regards,

Daniel

Answer - Posted 1 month ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Daniel,

We have the code for our Microsoft DataGrid add-on as open source.  You can find that cell style's source here on GitHub.


Actipro Software Support

Posted 1 month ago by Daniel Constantin - ModuleWorks GmbH
Avatar

Hi!

I am testing with the TreeListView and I am creating the TreeListViewColumn's and over there as a CellTemplate I have a DataTemplate.

The problem is that somehow the bindings are not working and I have this errors :

"BindingExpression path error: 'IsSelected' property not found on 'object' ''PixelSnapper' (Name='')'. BindingExpression:Path=IsSelected; DataItem='PixelSnapper' (Name=''); target element is 'Image' (Name=''); target property is 'NoTarget' (type 'Object')"

Depending on IsSelected I change an image inside that cell.

What might be the problem?

Kind regards,

Daniel

Posted 1 month ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Daniel,

It's difficult to say without debugging your particular scenario.  If you'd like us to assist, kindly put together this scenario in a new simple sample project, describe the problem and expected results, and send all that to our support e-mail address.  Reference this thread in your email and be sure to exclude the bin/obj folders from the .zip you send so it doesn't get spam blocked.  Then we can debug with that and see what's going on.


Actipro Software Support

Posted 29 days ago by Daniel Constantin - ModuleWorks GmbH
Avatar

Hi!

I just send an email with the sample in which the problem is replicable.

Kind regards,

Daniel

Answer - Posted 29 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Daniel,

The mysterious PixelSnapper mentioned in the Binding error is a root element added programmatically in the TreeListViewItemRowPanel.CreateCellElement method when DisplayMemberBinding is specified.  In that scenario, it is making a PixelSnapper that wraps a TextBlock and assigns the TextBlock's DataContext to the DataContext as well as the DisplayMemberBinding to the TextBlock.Text property.  The PixelSnapper becomes the cell's Content.

Whereas when DisplayMemberBinding is not specified, it just uses the DataContext directly as Content and applies the ContentTemplate properties.

In your sample project, if you open ItemsControl.Populate and remove the "DisplayMemberBinding = new Binding()" line, it seems to work since then the Content is the viewmodel you use.  You would not want to use DisplayMemberBinding in this sample since your DataTemplate is making controls (i.e. Border, TextBlock, etc.).

I hope that helps.


Actipro Software Support

Add Comment

Please log in to a validated account to post comments.