Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
240
Automatic grouping in xamdatatree
posted

I have the following enumerable property which I am binding to XamDataTree

 

public

 

 

IEnumerable<AccountList> AccountListView

{

 

 

 

get { return m_AccountList; }

 

 

 

set

{ m_AccountList =

 

value;

);

 

Type AccountList has the following structure  - 

 

public

 

 

partial class AccountList : object, System.ComponentModel.INotifyPropertyChanged

{ public string accountId;   

 

 

 

  public string currencyCode;

 

 

 

  public string startDate;

}

AccountListView has a collection of type AccountList , and in the collection, two different instances can have same accountId but different currencyCode and startDate fields.

My requirement is that XamdataTree should automatically group the list based on the account id and curreny code and shows the hierarchy as AccountID - currencyCode - start Date

For example, if the list has collection such as 

 

 (Please ignore the syntax)

new  AccountList {accountId ="Test1", currencyCode = "USD", startDate = "9/9/2011"}

new  AccountList {accountId ="Test1", currencyCode = "USD", startDate = "9/10/2011"}

 

 

new  AccountList {accountId ="Test1", currencyCode = "EUR", startDate = "9/9/2011"}

new  AccountList {accountId ="Test2", currencyCode = "USD", startDate = "8/9/2011"}

new  AccountList {accountId ="Test2", currencyCode = "EUR", startDate = "8/10/2011"}

The tree should show something like this -

Test1

           USD

                   9/9/2011

        9/10/2011 

           EUR

                   9/9/2011

Test2

           USD

                   8/9/2011

     EUR

                  8/10/2011

 Can anyone please help me on how to achieve this using XamDataTree.

Thanks in advance.

 

 

 

 

 

 

 

 

 

 

public partial class AccountList : object, System.ComponentModel.INotifyPropertyChanged

{

 

 

 

 

private string

buIDField;

 

 

 

 

private string

accountIDField;

 

 

 

 

private string

currencyCDField;

 

 

 

 

private string

balanceClassCDField;

 

 

 

 

private System.DateTime

valueDateField;

 

 

 

 

private decimal

originalBalanceAdjustmentField;

 

 

 

 

private decimal

netBalanceAdjustmentField;

 

 

 

 

///

<remarks/>

 

[System.Xml.Serialization.

 

 

XmlElementAttribute

 

(Order=0)]

 

 

 

public string

BuID {

 

 

 

get

{

 

 

 

return this

.buIDField;

}

 

 

 

set

{

 

 

 

this.buIDField = value

;

 

 

 

this.RaisePropertyChanged("BuID"

);

 

 

Parents
No Data
Reply
  • 12875
    posted

    Hi,

    Looks like you need to convert your class to a hierarchical structure.
    You could have a collection of accountId that contain a collection of currencyCode, which in turn has a collection of startDate.  

    This is a lot more complicated in design but our DataUtil will give you the idea.

    http://help.infragistics.com/NetAdvantage/Silverlight/2011/1/CLR4.0/?page=Resources_DataUtil.html
     

    Or here is a very simple example that you could consider.

        public class StaffMember
        {   public string Name { get; set; }
            public ObservableCollection Periods { get; set; }
        }
        public class Period
        {    public string ClassTitle { get; set; }
             public ObservableCollection Hour { get; set; }
        } 
        public class Hour
        {
         public int Hour { get; set; }
        } 
    
Children