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.

I am not getting a resized column to its previous state.

Thread ID:

Created:

Updated:

Platform:

Replies:

75125 Jul 14,2008 07:41 AM Jul 15,2008 04:00 AM WPF 7
loading
Tags: GridControl
subindev
Asked On July 14, 2008 07:41 AM

Hello ,
I am using syncfusion essential grid for wpf.
When i resize a column to its minimum size it will get hidden, and i am not getting that column back in to its previous state.
One morething i would like to know whether this grid control has a support to export data to Excel???


Administrator [Syncfusion]
Replied On July 14, 2008 09:15 AM

In our Windows Forms Grid, you double click the column header border to re-display a hidden column. Currently, this is not implemented in the WPF grid. But you could implement it catching an event.

//subscribe to the event
grid1.PreviewMouseDown += new MouseButtonEventHandler(grid1_PreviewMouseDown);

//the event handler
void grid1_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
if (e.ClickCount == 2)
{
RowColumnIndex cell = grid1.PointToCellRowColumnIndex(e.GetPosition(grid1), true);
if (cell.RowIndex == 0 && cell.ColumnIndex > 0 && grid1.Model.ColumnWidths[cell.ColumnIndex - 1] == 0)
{
grid1.Model.ColumnWidths[cell.ColumnIndex-1] = grid1.ColumnWidths.DefaultLineSize;
grid1.InvalidateVisual(true);
}
e.Handled = true;
}
}


Our Windows Forms grids directly support Excel export through helper classes that use our XlsIO library to export the grids. Currently, this type of support is not in our WPF Grid library, but will be in some future release. I do not know of any announced dates for such support. Until then, you would have to use our XlsIO library directly to expect to Excel from our WPF Grid. This may be a simple task depending upon eaxctly what you want expected. If all you want is the values, then that would be straight-forwards. If you want some kind of WYSIWYG export, that would be a more extensive undertaking.



subindev
Replied On July 14, 2008 11:48 PM

Hello Clay,
Thanks a lot for your quick reply. I will try this snippet and let you know the result. I would like know about one more feature (Cell Sorting) that you provided in windows grid control. Is that feature available in WPF Grid Control also?

>In our Windows Forms Grid, you double click the column header border to re-display a hidden column. Currently, this is not implemented in the WPF grid. But you could implement it catching an event.

//subscribe to the event
grid1.PreviewMouseDown += new MouseButtonEventHandler(grid1_PreviewMouseDown);

//the event handler
void grid1_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
if (e.ClickCount == 2)
{
RowColumnIndex cell = grid1.PointToCellRowColumnIndex(e.GetPosition(grid1), true);
if (cell.RowIndex == 0 && cell.ColumnIndex > 0 && grid1.Model.ColumnWidths[cell.ColumnIndex - 1] == 0)
{
grid1.Model.ColumnWidths[cell.ColumnIndex-1] = grid1.ColumnWidths.DefaultLineSize;
grid1.InvalidateVisual(true);
}
e.Handled = true;
}
}


Our Windows Forms grids directly support Excel export through helper classes that use our XlsIO library to export the grids. Currently, this type of support is not in our WPF Grid library, but will be in some future release. I do not know of any announced dates for such support. Until then, you would have to use our XlsIO library directly to expect to Excel from our WPF Grid. This may be a simple task depending upon eaxctly what you want expected. If all you want is the values, then that would be straight-forwards. If you want some kind of WYSIWYG export, that would be a more extensive undertaking.





Administrator [Syncfusion]
Replied On July 15, 2008 02:58 AM

Currently, there is no direct support for sorting in the WPF grid. But, if you virtually bind the grid to a datasource that supports sorting, (like a DataTable or sortable BindingList), then you can use tie that sorting support into the grid. Here is a link to a sample.
http://www.syncfusion.com/support/user/uploads/VirtualGridDataTableSort_4e45ef8d.zip


subindev
Replied On July 15, 2008 03:06 AM

This is excellent,
One more thing , i have tested ur previous code snippet (MouseButtonEventHandler). It is working very fine.But i cannot unhide the last row or last column if i resized...
any thanks a lot fop ur help and support.


Administrator [Syncfusion]
Replied On July 15, 2008 03:23 AM

You can tweak the code in the if statement to catch this last column case.

void grid_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
if (e.ClickCount == 2)
{
RowColumnIndex cell = grid.PointToCellRowColumnIndex(e.GetPosition(grid), true);
if (cell.RowIndex == 0 && cell.ColumnIndex > 0)
{
if (grid.Model.ColumnWidths[cell.ColumnIndex - 1] == 0)
{
grid.Model.ColumnWidths[cell.ColumnIndex - 1] = grid.ColumnWidths.DefaultLineSize;
grid.InvalidateVisual(true);
}
else if (cell.ColumnIndex == grid.Model.ColumnCount - 2 && grid.Model.ColumnWidths[cell.ColumnIndex + 1] == 0)
{
grid.Model.ColumnWidths[cell.ColumnIndex + 1] = grid.ColumnWidths.DefaultLineSize;
grid.InvalidateVisual(true);
}
}
e.Handled = true;
}
}



subindev
Replied On July 15, 2008 03:50 AM

Thanks a lot Caly.:)


subindev
Replied On July 15, 2008 04:00 AM

Sorry:),
Thanks a lot Clay ..


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.

;