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.
Unfortunately, activation email could not send to your email. Please try again.

Binding feature question

Thread ID:

Created:

Updated:

Platform:

Replies:

75935 Aug 15,2008 11:09 AM Aug 18,2008 02:16 PM WPF 4
loading
Tags: GridControl
Jeff Yang
Asked On August 15, 2008 11:09 AM

From looking at previous posts, data binding support is not built-in to the WPF grid. When the feature is implemented, will it have the capability of automatically populating the grid columns and values based on the public properties of the object/interface? I have worked with other grid where this was possible and it made managing the data as easy as managing an IList<>.



Administrator [Syncfusion]
Replied On August 15, 2008 12:02 PM

Yes, our databinding support will handle these tasks for you when it becomes available.

One comment is that such support (in a minimal form) is fairly straight forward to do with our WPF GridControl because of its virtual support. Here is a minimal sample showing how you can use a virtual grid to display an IList<> source with the virtual events.
http://www.syncfusion.com/support/user/uploads/BindingHelperSample_c214a724.zip

When we publish our databinding support, it will be much more fully featured than this simple sample.



Jeff Yang
Replied On August 18, 2008 01:23 PM

Thanks for the example. So another question, if I want the grid to update whenever I update items in my IList<>, would the correct way be to call InvalidateCell then InvalidateVisual (as described in the documentation comments for the InvalidateCell method? I want to make sure that I am doing as little repainting as possible. Lastly, I see that all InvalidateVisual overloads take in an object which represents the cell/cell range to invalidate. Is there anyway to get at already instantiated objects representing the cell cooridinates. The reason I'm asking is because of the frequency of updates to my grid, new-ing an object everytime I update is going to increase the time spent in GC



Jeff Yang
Replied On August 18, 2008 01:25 PM

"...I see that all InvalidateVisual overloads take in an object..."

should be:

"...I see that all InvalidateCell overloads take in an object..."


Administrator [Syncfusion]
Replied On August 18, 2008 02:16 PM

You will have to create a new CellSpanInfo object for each change unless you know explicitly the cells that change and can somehow cache CellSpanInfo objects and simple recall them from your cache.

In that sample, if you change the List to BindingList and makes sure your raise the ListChanged event somehow when values change, then you can use code like this to trigger the screen refreshes.

void list_ListChanged(object sender, ListChangedEventArgs e)
{
IList list = sender as IList;
switch (e.ListChangedType)
{
case ListChangedType.ItemChanged:
if (e.NewIndex > -1 && e.NewIndex < list.Count)
{
grid.InvalidateCell(new CellSpanInfo(e.NewIndex + 1, 1, e.NewIndex + 1, grid.Model.ColumnCount));
grid.InvalidateVisual(false);
}
break;
default:
break;
}
}




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.

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.

;