I want to be able to define which columns I want to show up. I also want to be able to call my own custom sorting when the user clicks on the column header. I saw these articles:
http://forums.labs.infragistics.com/forums/t/1056 and aspx, http://forums.labs.infragistics.com/forums/t/1009.aspx
which basically summarize what I am trying to do. My problem is that I can create the fields but when I attach a labelPresenter to it and run the code the header text is only halfway showing. Also it looks like the labelPresenter part is seperately clickable in the header and when I click on it, I get the exception "Object reference not set to an instance of an object." and the call stack just says external code (it doesn't even show me what line it errors on).
I couldn't really find any example code of using the LabelPresenter and could use some tips. Below is my code:
dg.FieldSettings.LabelClickAction = LabelClickAction.Nothing; dg.FieldLayoutSettings.AutoGenerateFields = false; FieldLayout fl = new FieldLayout(); Field field = new Field(); LabelPresenter presenter = new LabelPresenter(); presenter.Content = "Name"; field.Label = presenter; presenter.MouseUp += new MouseButtonEventHandler(presenter_MouseUp); field.Name = "Name"; fl.Fields.Add(field); dg.FieldLayouts.Add(fl); List<Animal> test = new List<Animal>(); test.Add(new Animal()); test.Add(new Animal()); test.Add(new Animal()); for(int i = 0; i< 1000; i++) test.Add(new Animal()); dg.DataSource = test;
I'm not sure what is causing the exception. To get help with that you should contact developer support at http://devcenter.infragistics.com/Protected/SubmitSupportIssue.aspx.
BTW, if you are just interested in doing some custom sorting logic you can create an object that implements the IComparer interface and set it as the Field.Settings.SortComparer property.
I hope this helps.
has this issue been solved as i am encountering the same problem?