This is a migrated thread and some comments may be shown as answers.

faceted object

1 Answer 38 Views
GridView
This is a migrated thread and some comments may be shown as answers.
tomas
Top achievements
Rank 1
tomas asked on 26 Aug 2013, 09:43 PM
Hi,

I am using this:
http://www.damonpayne.com/post/2011/04/14/Using-ICustomTypeProvider-in-Silverlight-5.aspx

I am generating itemsSource like this:

for

 

 

(int i = 0; i < dtData.Rows.Count; i++)

 

{

dataRow = dtData.Rows[i];

vmNuggetResult =

 

VmNugget.GetInstance((long)dataRow[1]);

 

vmNuggetResult.Id = (

 

long)dataRow[0];

 

vmNuggetResult.NuggetType =

 

new VmNugget() { Id = (long)dataRow[1], Name = (string)dataRow[2] };

 

vmNuggetResult.Author =

 

new VmNugget() { Id = (long)dataRow[3], Name = (string)dataRow[4] };

 

 

 

if (!dataRow.IsNull(5))

 

vmNuggetResult.Created = (

 

DateTime)dataRow[5];

 

 

 

// facets

 

vmNuggetResult.Cols.AddFacet(

 

"name", typeof(string));

 

 

 

if (!dataRow.IsNull(6))

 

vmNuggetResult.Cols[

 

"name"] = (string)dataRow[6];

 

vmNuggetResult.Cols.AddFacet(

 

"description", typeof(string));

 

 

 

if (!dataRow.IsNull(7))

 

vmNuggetResult.Cols[

 

"description"] = (string)dataRow[7];

 

 

 

this.vmQueryExecuted.Rows.Add(vmNuggetResult);

 

}



As you can see, I am adding two dynamic properties to Cols (typeof = FacetedObject). Both of type string.

I am generating datatemplate dynamically on the server and loding it with

XamlReader

 

 

.Load

 


My dataTemplate looks like that:

vmQuery.ContentControlXamlStyle =

@"

<DataTemplate

xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""

xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""

xmlns:converters=""clr-namespace:SUS.Assets.Converters;assembly=SUS""

xmlns:selectors=""clr-namespace:SUS.Assets.DataTemplateSelectors;assembly=SUS""

xmlns:telerik=""http://schemas.telerik.com/2008/xaml/presentation""

xmlns:helpers=""clr-namespace:SUS.Assets.Helpers;assembly=SUS""

>

<telerik:RadGridView IsReadOnly=""True"" AutoGenerateColumns=""False"" ItemsSource=""{Binding Rows}""

helpers:TelerikGridHelper.Grid=""{Binding RelativeSource={RelativeSource Self}}""

>

<telerik:RadGridView.Columns>

<telerik:GridViewDataColumn DataMemberBinding=""{Binding Id}"" Header=""Id"" />

<telerik:GridViewDataColumn DataMemberBinding=""{Binding NuggetType.Id}"" Header=""NuggetTypeId"" />

<telerik:GridViewDataColumn DataMemberBinding=""{Binding NuggetType.Name}"" Header=""Typ příspěvku"" />

<telerik:GridViewDataColumn DataMemberBinding=""{Binding Author.Name}"" Header=""Autor"" />

<telerik:GridViewDataColumn DataMemberBinding=""{Binding Created}"" Header=""Vytvořeno"" />

<telerik:GridViewDataColumn DataMemberBinding=""{Binding Cols.name}"" Header=""Pojem"" />

<telerik:GridViewDataColumn DataMemberBinding=""{Binding Cols.description}"" Header=""Výklad"" />

</telerik:RadGridView.Columns>

</telerik:RadGridView>

</DataTemplate>

"

 

 

;

 



The problem is, that although the faceted columns are populated, it is not possible to use them to filter, order or group data.

Do you know, where is the problem please?

I have thought it is possible to use your grid with a  faceted object.

Thank you.

Tom












1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 27 Aug 2013, 10:12 AM
Hello,

We use LINQ for sorting, filtering and grouping so you will have to hint the dynamic columns about the actual data type they will show by setting their DataType property. If this does not help, can you please prepare and attach a dummy project which we can debug locally to see what is going on inside the data engine. Thanks in advance.

Regards,
Rossen Hristov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
tomas
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or