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

Grouping and Sorting Disabled when Binding to Object Sub Properties

3 Answers 99 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jaime
Top achievements
Rank 2
Jaime asked on 17 Mar 2009, 10:04 PM
hi,

Sorting and Grouping works well, but I ran into a case where Grouping ans sorting get disabled. 

Here is the code.

<

 

telerikGridView:RadGridView x:Name="SIACMessages" IsReadOnly="True" ColumnsWidthMode="Fill" AutoGenerateColumns="False" >

 

 

 

 

<telerikGridView:RadGridView.Columns>

 

 

 

 

<telerikGridView:GridViewDataColumn DataMemberPath="From.Name" HeaderText="De:" />

 

 

 

 

<telerikGridView:GridViewDataColumn DataMemberPath="Subject" HeaderText="Asunto:"/>

 

 

 

 

<telerikGridView:GridViewDataColumn DataMemberPath="ReceivedDate" HeaderText="Fecha de Recepci¢n:"/>

 

 

 

 

</telerikGridView:RadGridView.Columns>

 

 

 

 

</telerikGridView:RadGridView>

When you use Property.Subproperty, this functionality gets automatically disabled. On the other columns works fine.

This is the object Structure that is being Binded.

 

namespace

 

SIACLookSL

 

{

 

 

public class VisualSIACMail : SIACMail

 

 

 

 

 

{

 

 

private SIACMail emailSIAC;

 

 

 

public SIACMail EmailSIAC

 

{

 

 

get { return emailSIAC; }

 

 

 

set { emailSIAC = value; }

 

}

 

 

public VisualSIACMail(SIACMail mail)

 

{

 

 

this.Cc = mail.Cc;

 

 

 

this.Content = mail.Content;

 

 

 

this.From = mail.From;

 

 

 

this.HtmlBody = mail.HtmlBody;

 

 

 

this.IsEncrypted = mail.IsEncrypted;

 

 

 

this.IsSigned = mail.IsSigned;

 

 

 

this.MailIndex = mail.MailIndex;

 

 

 

this.Priority = mail.Priority;

 

 

 

this.ReceivedDate = mail.ReceivedDate;

 

 

 

this.ReplyTo = mail.ReplyTo;

 

 

 

this.SentDate = mail.SentDate;

 

 

 

this.Subject = mail.Subject;

 

 

 

this.Tag = mail.Tag;

 

 

 

this.TextBody = mail.TextBody;

 

 

 

this.To = mail.To;

 

emailSIAC = mail;

}

 

 

public VisualSIACMail()

 

{

}

 

 

public String icon { get; set; }

 

 

 

 

public SIAC.Enlaces.SIACNegocio.SIACMail ToNegocio()

 

{

SIAC.Enlaces.SIACNegocio.

 

SIACMail obMail = new SIAC.Enlaces.SIACNegocio.SIACMail();

 

SIAC.Enlaces.SIACNegocio.

 

SIACMailAddress adress = new SIAC.Enlaces.SIACNegocio.SIACMailAddress();

 

 

 

if (this.Cc != null)

 

{

obMail.Cc =

 

new System.Collections.ObjectModel.ObservableCollection<SIAC.Enlaces.SIACNegocio.SIACMailAddress>();

 

 

 

foreach (SIACMailAddress item in this.Cc)

 

{

adress.Additional = item.Additional;

adress.Address = item.Address;

adress.Name = item.Name;

obMail.Cc.Add(adress);

}

}

obMail.Content =

 

this.Content;

 

 

 

if (this.From != null)

 

{

obMail.From =

 

new SIAC.Enlaces.SIACNegocio.SIACMailAddress();

 

obMail.From.Additional =

 

this.From.Additional;

 

obMail.From.Address =

 

this.From.Address;

 

obMail.From.Name =

 

this.From.Name;

 

}

obMail.HtmlBody =

 

this.HtmlBody;

 

obMail.IsEncrypted =

 

this.IsEncrypted;

 

obMail.IsSigned =

 

this.IsSigned;

 

obMail.MailIndex =

 

this.MailIndex;

 

 

 

//this.Priority

 

 

 

 

 

 

 

switch (this.Priority)

 

{

 

 

case SIACMailPriority.Normal:

 

obMail.Priority = SIAC.Enlaces.SIACNegocio.

 

SIACMailPriority.Normal;

 

 

 

break;

 

 

 

case SIACMailPriority.High:

 

obMail.Priority = SIAC.Enlaces.SIACNegocio.

 

SIACMailPriority.High;

 

 

 

break;

 

 

 

case SIACMailPriority.Low:

 

obMail.Priority = SIAC.Enlaces.SIACNegocio.

 

SIACMailPriority.Low;

 

 

 

break;

 

 

 

default:

 

 

 

break;

 

}

obMail.ReceivedDate =

 

this.ReceivedDate;

 

 

 

if (this.ReplyTo != null)

 

{

obMail.ReplyTo =

 

new SIAC.Enlaces.SIACNegocio.SIACMailAddress();

 

obMail.ReplyTo.Additional =

 

this.ReplyTo.Additional;

 

obMail.ReplyTo.Address =

 

this.ReplyTo.Address;

 

obMail.ReplyTo.Name =

 

this.ReplyTo.Name;

 

}

obMail.SentDate =

 

this.SentDate;

 

obMail.Subject =

 

this.Subject;

 

obMail.Tag =

 

this.Tag;

 

obMail.TextBody =

 

this.TextBody;

 

 

 

if (this.To != null)

 

{

obMail.To =

 

new System.Collections.ObjectModel.ObservableCollection<SIAC.Enlaces.SIACNegocio.SIACMailAddress>();

 

 

 

foreach (SIACMailAddress item in this.To)

 

{

adress.Additional = item.Additional;

adress.Address = item.Address;

adress.Name = item.Name;

obMail.To.Add(adress);

}

}

 

 

return obMail;

 

}

}

Thanx in advance. 

3 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 18 Mar 2009, 12:04 PM
Hello Jaime,

I just checked our online example here: http://demos.telerik.com/silverlight/#GridView/DataSources and everything worked fine when the grid is bound to sub properties.

Sincerely yours,
Vlad
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jaime
Top achievements
Rank 2
answered on 18 Mar 2009, 07:15 PM
Hi Vlad,

Thanks for you orientation,

I tried adding the column from code behind and it worked properly, Code as follows.

SIACMessagesGrid.Columns.Add(

new GridViewDataColumn()

 

{

DataMemberPath =

"From.Name",

 

UniqueName =

"From.Name",

 

DataType =

typeof(string),

 

HeaderText =

"Remitente"

 

});

But from the XAML doesn't, I get a Bad Property Error. Code as Follows:

 

<

 

telerikGridView:RadGridView x:Name="SIACMessages" IsReadOnly="True" ColumnsWidthMode="Fill" AutoGenerateColumns="False" >

 

 

 

<telerikGridView:RadGridView.Columns>

 

 

 

<telerikGridView:GridViewDataColumn DataMemberPath="From.Name" DataType="System.String" UniqueName="From.Name" HeaderText="De:" />

 

 

 

<telerikGridView:GridViewDataColumn DataMemberPath="Subject" HeaderText="Asunto:"/>

 

 

 

<telerikGridView:GridViewDataColumn DataMemberPath="ReceivedDate" HeaderText="Fecha de Recepci¢n:"/>

 

 

 

</telerikGridView:RadGridView.Columns>

 

 

 

</telerikGridView:RadGridView>

The problem seems to be in the DataType property. any Guess?

Thanks a lot.

Jaime

 

0
Stefan Dobrev
Telerik team
answered on 20 Mar 2009, 11:06 AM
Hi Jaime,

The problem in your case is that you are defining the DataType of the Column in XAML - in your case it is String. Silverlight currently lacks the possibility to declare types in XAML. Just remove the DataType attribute from the XAML and everything should work fine. The data type will be correctly resolved by our data binding engine:

<telerikGridView:GridViewDataColumn DataMemberPath="From.Name" DataType="System.String" UniqueName="From.Name" HeaderText="De:" /> 

Hope this helps.

Kind regards,
Stefan Dobrev
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Jaime
Top achievements
Rank 2
Answers by
Vlad
Telerik team
Jaime
Top achievements
Rank 2
Stefan Dobrev
Telerik team
Share this question
or