We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridListControl with virtual grid inside

Thread ID:

Created:

Updated:

Platform:

Replies:

23993 Jan 26,2005 03:00 PM UTC Jan 31,2005 03:14 PM UTC WinForms 7
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On January 26, 2005 03:00 PM UTC

I have a form on which I have two GridListControls. In both cases, there is no assigned datasource. Instead, I am treating the contained grid control as a virtual grid via the Queryxxx methods. On my machines, as well as some others, this works perfectly. However, on a couple other machines, the Queryxxx methods are never called for the contained grid controls resulting in an empty list display. All machines in question are running XP pro, and all machines are running the exact same build. This is a tricky problem because I cannot duplicate it myself. We determined that the Queryxxx methods are not being called because another developer does have the problem and was able to debug and place some breakpoints which are never hit in the Queryxxx methods. I thought to just convert the controls to use a Datasource, although that gives me less control. And I will try that. But in the meantime, is there anything you know that might be causing this problem? Thanks, Andy

Administrator [Syncfusion]
Replied On January 26, 2005 04:05 PM UTC

If it is the exact same code running code (ie same exe + same syncfusion dll''s), then I am at a loss. One general reason that events may not be hit are the problems arising due to dynamic splitters. But such problems do not normally vary from system to system if the same code is running. Here is a KB on using events with dynamic splitters. http://64.78.18.34/Support/article.aspx?id=580

Administrator [Syncfusion]
Replied On January 26, 2005 07:21 PM UTC

I looked at the KB item you referenced but I don''t think it applies here. There is a splitter control in the form in question, but it''s just a plain old .net splitter control. Incidentally, this problem occurs with both 2.1.0.9 and 3.0.1.0. Very strange. I''ll see if I can put together a sample app that duplicates the problem. I''ll send it to the people on whose machines the problem exists and if they still see the same problem, I''ll forward the sample app over to you to see if you can duplicate it. Andy

Administrator [Syncfusion]
Replied On January 27, 2005 09:14 PM UTC

I have not yet put together a sample app to send. In the meantime, I commented out the Queryxxx methods and just made the GridListControl''s DataSource point at my ArrayList of objects. Then sent a build to one of the people on who''s machine the GLC was showing up empty before. With "direct data-binding", it worked. So the problem seems to have something to do with using a virtual grid within a GLC. This gives me more information but doesn''t really solve my problem entirely because I need to have greater control over the column labels and order of columns in the GLC which direct data-binding is not providing me. Or at least, I don''t know how to control those things via direct data-binding. Incidentally, I tried to use the Bindable(false) attribute on one of the properties of my "business object" contained in the array list. I was sort of hoping that that attribute would be respected by the GLC''s binding logic, and would hide that property from the GLC, but it doesn''t work. This leads me to wonder if you guys would find it worthwhile to support some custom attributes we can use with properties to help in data-binding w/Syncfusion controls. For example, to make a property of my business object visible in the control, to make it the 3rd column, and to provide a nicer column label): [Bindable(true)] [BindingOrder(3)] [BindingCaption("Long Name")] public string LongName { get(...); set(...); } The "BindingOrder" would be problematic I guess, the user could quite easily provide values that don''t make sense (leaving gaps and so forth). But maybe we can have a class-level attribute that specifies that we want the binding order to be the order the attributes physically appear in the class rather than alphabetical as it seems they are bound now. Although perhaps reflection doesn''t keep that information around. I am still quite a neophyte at C# and .net programming (at least compared with C++ and WinSDK stuff). So it could be that there is already something along these lines already provided. Andy

Administrator [Syncfusion]
Replied On January 27, 2005 10:09 PM UTC

You can control the display order of the proerties in your ArrayList objects by having your ArrayList implement ITypedList. Here is a forum thread that has sample code. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=9194 In the GetItemsProperties, get the default property order using the techinque shown in this forum thread. But before returning the collection, reorder the colection to the order you prefer.

Administrator [Syncfusion]
Replied On January 27, 2005 11:16 PM UTC

I implemented the ITypedList as suggested. That gets me the correct sort order. I''m now looking for ways to modify the column label for the given property (i.e. turn "ShortName" into "Name"). The MemberDescriptor.DisplayName member looked promising but I''m not sure if that''s what you guys use when adding column labels or if you just go by MemberDescriptor.Name. Also, it''s not entirely clear to me how I can set the DisplayName member anyway since it''s a read-only property, there''s no constructor arguement for it and it doesn''t appear to be set via an attribute (like Description is, for instance). Thanks, Andy

Administrator [Syncfusion]
Replied On January 28, 2005 06:04 AM UTC

To control the header text, you will have to handle some event. GridListControl.Grid.QueryCellInfo should work, or GridListControl.Grid.DrawCellDisplayText as shown below.
private void Grid_DrawCellDisplayText(object sender, GridDrawCellDisplayTextEventArgs e)
{
	if(e.Style.CellIdentity.RowIndex == 0)
	{
		e.DisplayText = string.Format("header{0}", e.Style.CellIdentity.ColIndex);
	}
}

Administrator [Syncfusion]
Replied On January 31, 2005 03:14 PM UTC

Clay, Your suggestion to implement ITypedList spurred me to find out more about the whole .net binding mechanism (and reflection) over the weekend. After discovering the various moving parts involved in binding, I wrote some classes that allow me to use attributes to control the display of class properties when bound to the Syncfusion grid (or any other complex binding control). I have a CustomBindableArrayList that implements ITypedList and can be parameterized over the contained data-type (i.e. the class object to which I want a control to bind). I also have a CustomPropertyDescriptor that inherits from PropertyDescriptor. My derived version allows me to associate a custom name for any property of a class. That attribute is "discovered" via reflection by my CustomBindableArrayList''s ITypeList GetItemProperties method. Finally, I had to create a CustomPropertyNameAttribute attribute that targets properties and allows the association of a string (the custom property name) with any property of a class. I''m also adding support for a class-targetted property that allows me to specify in what order the properties in that class should appear to any bound control. This lets me easily customize the order of the columns in a grid control bound to an ArrayList of class objects. I did have to write a bit of code to get all this to work right, and I''m sure I still have a few kinks to work out, but it''s a generic solution applicable to any "business object" I want to bind to a grid while still retaining easy control over what is displayed. I realize that I could control all this programmatically through the grid, but it just seems simplier to assign a couple attributes to the class. Incidentally, there is a very simple way to "hide" columns from being bound. The [Browseable(false)] attribute is respected by various .net framework controls as well as by the GridListControl (at least, and I''m guessing Grids and GridDataBoundGrids as well). That''ll work "right out of the can" without any need to implement ITypedList and so forth. The end result of all this is that I can bind an ArrayList of Customer objects (for example) to a grid and although the grid wants to display the columns as: Address, Id, ShortName, I can easily (by applying 3 attributes) make the grid display "Id", "Name", "Street Address" or whatever else I want. To the grid control, those overridden property names are the actually property names - so I have no further event handling or coding do to in the grid to make it work. Thanks, Andy

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;