Home Forums WPF controls Xceed DataGrid for WPF DataGridCollectionView

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #23040 |

    I saw in the note about V1.1 that we should replace usage of CollectionView with the new DataGridCollectionView, in order to derive the performance benefits of the new version as related to grouping and filtering.

    I couldn’t find any documentation on it so I just assumed this is a straight replacement; however, I get an error at runtime:

    The tag ‘DataGridCollectionView’ does not exist in XML namespace ‘http://schemas.microsoft.com/winfx/2006/xaml/presentation’. Line ‘1’ Position ‘36953’.

    Here is the DataGridCollectionView that I have defined in the resources section of the enclosing control (a WPF Grid), which is a straight replacement of CollctionView:

    <DataGridCollectionView x:Key=”DataView” CollectionViewType=”{x:Type ListCollectionView}” Source=”{Binding Mode=OneWay, Source={StaticResource DataProvider}, XPath=Rows/Row}”>
    <DataGridCollectionView.GroupDescriptions>
    <dat:PropertyGroupDescription PropertyName=”QueryTitle” />
    </DataGridCollectionView.GroupDescriptions>
    </DataGridCollectionView>

    Thanks for any help.

    Marty

    Imported from legacy forums. Posted by Marty (had 7089 views)

    User (Old forums)
    Member
    Post count: 23064

    Oops.
    It looks like I should be using DataGridCollectionViewSource in the XAML.
    However I still get the same error.
    I will bang on this a little more.

    Marty

    Imported from legacy forums. Posted by Marty (had 708 views)

    Xceed Support
    Member
    Post count: 5658

    Use xcdg:DataGridCollectionViewSource instead of DataGridCollectionViewSource.

    The DataGridCollectionViewSource is contained within our assemblies, hence the need to prefix it with our namespace.

    Note: the xcdg namespace need to be defined in your XAML files.

    Also, seeing your code snippet, I can suggest another improvement (in the mean time the documentation is online).

    Instead of using a PropertyGroupDescription, you could use the new class DataGridGroupDescription, which will provide enhanced performance for the grouping.

    usage of the DataGridGroupDescription is similar to the original PropertyGroupDescription class.

    Note: you will also need to prefix the class with xcdg:

    Imported from legacy forums. Posted by Marcus [Xceed] (had 369 views)

    Xceed Support
    Member
    Post count: 5658

    Just to help you out until the documentation is online:

    <code>
    <Grid xmlns:xcdg=”http://schemas.xceed.com/wpf/xaml/datagrid”&gt;
    <Grid.Resources>
    <xcdg:DataGridCollectionViewSource x:Key=”cvs_orders”
    Source=”{Binding Source={x:Static Application.Current},
    Path=Orders}”>
    <xcdg:DataGridCollectionViewSource.GroupDescriptions>
    <xcdg:DataGridGroupDescription PropertyName=”ShipCountry”/>
    <xcdg:DataGridGroupDescription PropertyName=”ShipCity”/>
    </xcdg:DataGridCollectionViewSource.GroupDescriptions>
    </xcdg:DataGridCollectionViewSource>
    </Grid.Resources>

    <xcdg:DataGridControl x:Name=”OrdersGrid”
    ItemsSource=”{Binding Source={StaticResource cvs_orders}}”>
    </xcdg:DataGridControl>
    </Grid>
    </code>

    Imported from legacy forums. Posted by Jenny [Xceed] (had 439 views)

    Xceed Support
    Member
    Post count: 5658

    The documentation is now online 🙂

    Imported from legacy forums. Posted by Jenny [Xceed] (had 445 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks for the quick response.
    I found the doc and example in the installed version of the documentation, as Jenny mentioned.

    I think I am very close to getting this working. But I have a problem with the binding of the DataGridCollectionViewSource to the underlying datasource. Here is the error I get:

    <b>
    ‘DataProvider’ member is not valid because it does not have a qualifying type name. Error at Line 1 Position 37004.
    </b>

    Here is an abbreviated code sample (I removed a bunch of rows).
    Thanks for any tips and best regards….Marty.

    <Page Title=”Inquiry Text Search” xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221; xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml&#8221; Margin=”0″ xmlns:scm=”clr-namespace:System.ComponentModel;assembly=WindowsBase” xmlns:dat=”clr-namespace:System.Windows.Data;assembly=PresentationFramework”>
    <DockPanel x:Name=”DockPanel”>
    <Border DockPanel.Dock=”Bottom” x:Name=”ActionPanelBorder” Style=”{StaticResource ActionPanelBorderStyle}”>
    <StackPanel x:Name=”ActionPanel” Style=”{StaticResource ActionPanelStyle}” />
    </Border>
    <Grid xmlns:xcdg=”http://schemas.xceed.com/wpf/xaml/datagrid”&gt;
    <Grid.Resources>
    <XmlDataProvider x:Key=”DataProvider” XPath=”Data”>
    <x:XData>
    <Data xmlns=””>
    <Rows>
    <Row>
    <column0>100</column0>
    <column2>Inquiry 235099</column2>
    <column3>01/08/22 It was working and then one day it was not working error when runing text search in WC. will forward copy of error. </column3>
    <column4>INQUIRY MANAGEMENT </column4>
    <column5>14778</column5>
    <column6>235099</column6>
    <column7>sv_inquiry.inquiry_id</column7>
    <column8>20728560</column8>
    <column9>
    </column9>
    <column10>21256312</column10>
    <column11>
    </column11>
    <column12>fulcrum_inquiry</column12>
    <column13>sv_inquiry</column13>
    <column14>5184:5 7251:5 7814:5 7909:5 7989:5 8312:5 8687:5 8792:5 9284:5 9352:5 9589:5 9694:5 10735:5 10830:5 10954:5 11972:5 13151:5 13557:5 15337:5 15405:5 15642:5 15747:5</column14>
    <QueryTitle>Inquiry Text Search</QueryTitle>
    </Row>
    <Row>
    <column0>50</column0>
    <column2>Inquiry 231824</column2>
    <column3>Having some problems with Request Text Search </column3>
    <column4>INQUIRY MANAGEMENT </column4>
    <column5>12589</column5>
    <column6>231824</column6>
    <column7>sv_inquiry.inquiry_id</column7>
    <column8>20728560</column8>
    <column9>
    </column9>
    <column10>21256312</column10>
    <column11>
    </column11>
    <column12>fulcrum_inquiry</column12>
    <column13>sv_inquiry</column13>
    <column14>218:5 332:5 492:5 624:5 671:5 724:5 1310:5 1352:5 1424:5 1471:5 1532:5</column14>
    <QueryTitle>Inquiry Text Search</QueryTitle>
    </Row>
    </Rows>
    </Data>
    </x:XData>
    </XmlDataProvider>
    <xcdg:DataGridCollectionViewSource x:Key=”DataView” Source=”{Binding Source={x:Static DataProvider}, XPath=Rows/Row}”>
    <xcdg:DataGridCollectionViewSource.GroupDescriptions>
    <xcdg:DataGridGroupDescription PropertyName=”QueryTitle” />
    </xcdg:DataGridCollectionViewSource.GroupDescriptions>
    </xcdg:DataGridCollectionViewSource>
    <Style TargetType=”{x:Type xcdg:GroupByControl}”>
    <Setter Property=”Visibility” Value=”Collapsed” />
    </Style>
    </Grid.Resources>
    <xcdg:DataGridControl ReadOnly=”True” NavigationBehavior=”RowOnly” AutoCreateColumns=”False” x:Name=”dataGridControl” ItemsSource=”{Binding Mode=OneWay, Source={StaticResource DataView}}”>
    <xcdg:DataGridControl.View>
    <xcdg:TableView ShowRowSelectorPane=”False”>
    <xcdg:TableView.Theme>
    <xcdg:AeroNormalColorTheme />
    </xcdg:TableView.Theme>
    </xcdg:TableView>
    </xcdg:DataGridControl.View>
    <xcdg:DataGridControl.Columns>
    <xcdg:Column FieldName=”column0″ Title=”Score %” Width=”63.3333333333333″ DisplayMemberBinding=”{Binding XPath=column0}” />
    <xcdg:Column FieldName=”column2″ Title=”Object” Width=”120″ DisplayMemberBinding=”{Binding XPath=column2}” />
    <xcdg:Column FieldName=”column3″ Title=”Description” Width=”400″ DisplayMemberBinding=”{Binding XPath=column3}” />
    <xcdg:Column FieldName=”column4″ Title=”Form” Width=”0″ DisplayMemberBinding=”{Binding XPath=column4}” />
    <xcdg:Column FieldName=”column5″ Title=”FT_CID” Width=”0″ DisplayMemberBinding=”{Binding XPath=column5}” />
    <xcdg:Column FieldName=”column6″ Title=”Key1″ Width=”0″ DisplayMemberBinding=”{Binding XPath=column6}” />
    <xcdg:Column FieldName=”column7″ Title=”Key1Name” Width=”0″ DisplayMemberBinding=”{Binding XPath=column7}” />
    <xcdg:Column FieldName=”column8″ Title=”Key2″ Width=”0″ DisplayMemberBinding=”{Binding XPath=column8}” />
    <xcdg:Column FieldName=”column9″ Title=”Key2Name” Width=”0″ DisplayMemberBinding=”{Binding XPath=column9}” />
    <xcdg:Column FieldName=”column10″ Title=”Key3″ Width=”0″ DisplayMemberBinding=”{Binding XPath=column10}” />
    <xcdg:Column FieldName=”column11″ Title=”Key3Name” Width=”0″ DisplayMemberBinding=”{Binding XPath=column11}” />
    <xcdg:Column FieldName=”column12″ Title=”Fulcrum Table” Width=”0″ DisplayMemberBinding=”{Binding XPath=column12}” />
    <xcdg:Column FieldName=”column13″ Title=”Ent Table” Width=”0″ Displ

    Imported from legacy forums. Posted by Marty (had 670 views)

    Xceed Support
    Member
    Post count: 5658

    Instead of :

    <xcdg:DataGridCollectionViewSource x:Key=”DataView” Source=”{Binding Source={x:Static DataProvider}, XPath=Rows/Row}”>

    you should be using a StaticResource markup:

    <xcdg:DataGridCollectionViewSource x:Key=”DataView” Source=”{Binding Source={StaticResource DataProvider}, XPath=Rows/Row}”>

    Also, I suggest setting the IsAsynchronous property to false on your XmlDataProvider as there is a know issue concerning this (with the DataGridCollectionViewSource).

    Imported from legacy forums. Posted by Marcus [Xceed] (had 520 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks, past that one now.

    It appears that the markup for ItemsSource is incorrect, based on this error. I’m using the key ‘DataView’ and it appears to be correct but something is wrong. Sorry I am such an idiot.
    <b>
    ‘System.Windows.Data.BindingExpression’ value cannot be assigned to property ‘ItemsSource’ of object ‘Xceed.Wpf.DataGrid.DataGridControl’. A source must be specified. Error at object ‘System.Windows.Data.Binding’, Line 1 Position 37557.
    </b>

    Imported from legacy forums. Posted by Marty (had 605 views)

    User (Old forums)
    Member
    Post count: 23064

    I tried the suggestion provided in

    http://forums.xceed.com/forums/ShowPost.aspx?PostID=7426

    but got the same result as indicated there:
    <b>
    Cannot convert the value in attribute ‘ItemsSource’ to object of type ‘System.Collections.IEnumerable’. ‘Xceed.Wpf.DataGrid.DataGridCollectionViewSource’ is not a valid value for property ‘ItemsSource’. Error at object ‘dataGridControl’, Line 1 Position 37557.
    </b>

    Imported from legacy forums. Posted by Marty (had 7823 views)

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.