Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: DataGridControl Speed Improvement Suggestions?

$
0
0
Hi BoucherS,

I'm pretty sure we are trying to use the DataGrid in a way it wasn't meant to be used, unfortunately. We're trying to adapt the DataGrid to replace a simple, generic ListView control, with plans to expand the functionality afterward.

The majority of the logic that controls this grid is still in the C++ application which consumes the grid. But, if it helps, here is my XAML file:
<UserControl x:Class="WPFControls.DataTable"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
             xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"
             mc:Ignorable="d" 
             d:DesignHeight="400" d:DesignWidth="400">
    <Grid>
        <Grid.Resources>
            <DataTemplate x:Key="datatablecelltemplate">
                <Border Background="{Binding Background, UpdateSourceTrigger=PropertyChanged}">
                    <TextBlock TextTrimming="None" Text="{Binding Text, UpdateSourceTrigger=PropertyChanged}" Foreground="{Binding Foreground, UpdateSourceTrigger=PropertyChanged}">
                    </TextBlock>
                </Border>
            </DataTemplate>
<Style TargetType="{x:Type xcdg:ColumnManagerCell}">
                <Setter Property="HorizontalContentAlignment" Value="Center" />
                <EventSetter Event="PreviewMouseLeftButtonDown" Handler="ColumnManagerCellPreviewMouseLeftButtonDownHandler"/>
            </Style>

            <Style TargetType="{x:Type xcdg:DataCell}">
                <Setter Property="ContentTemplate" Value="{StaticResource datatablecelltemplate}" />
                <EventSetter Event="MouseRightButtonDown" Handler="DataCellMouseRightButtonDownHandler"/>
                <EventSetter Event="MouseLeftButtonUp" Handler="DataCellMouseLeftButtonUpHandler"/>
                <EventSetter Event="MouseDoubleClick" Handler="DataCellMouseDoubleClickHandler"/>
                <Setter Property="Padding" Value="0"/>
            </Style>

            <Style TargetType="{x:Type xcdg:TableViewScrollViewer}">
                <Setter Property="CanContentScroll" Value="false" />
            </Style>
        </Grid.Resources>

        <xcdg:DataGridControl x:Name="dg" AutoCreateColumns="True" SelectionUnit="Cell" SelectionMode="Extended" ReadOnly="True" ItemsSource="{Binding dataGridCollectionView}"  ScrollViewer.ScrollChanged="myGrid_ScrollChanged" ScrollViewer.IsDeferredScrollingEnabled ="false">
            <xcdg:DataGridControl.View>
                <xcdg:TableView HorizontalGridLineThickness="1" VerticalGridLineThickness="1" FixedColumnCount="1" UseDefaultHeadersFooters="False" ShowRowSelectorPane="False">
                    <xcdg:TableView.FixedHeaders>
                        <DataTemplate>
                            <xcdg:ColumnManagerRow AllowSort="False" AllowColumnReorder="False"/>
                        </DataTemplate>
                    </xcdg:TableView.FixedHeaders>
                    <xcdg:TableView.HorizontalGridLineBrush>
                        <SolidColorBrush Color="LightGray"/>
                    </xcdg:TableView.HorizontalGridLineBrush>
                    <xcdg:TableView.VerticalGridLineBrush>
                        <SolidColorBrush Color="LightGray"/>
                    </xcdg:TableView.VerticalGridLineBrush>
                </xcdg:TableView>
            </xcdg:DataGridControl.View>
        </xcdg:DataGridControl>
        <toolkit:ChildWindow x:Name="test" HorizontalAlignment="Left" VerticalAlignment="Top"/>
    </Grid>
</UserControl>

Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>