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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Header alignment

Thread ID:

Created:

Updated:

Platform:

Replies:

4224 May 4,2003 09:33 AM UTC May 5,2003 10:09 AM UTC WinForms 2
loading
Tags: GridControl
Jeremy Holt
Asked On May 4, 2003 09:33 AM UTC

How would you set column header alignment automatically in a GridDataBoundGrid. I want the header alignment to be the same as the column alignment. I've tried doing this in PrepareViewInfo, but it doesn't seem to work. The only way I can see to do this is to create a new HeaderBaseStyle, but I'm looking for a more "automated" way of doing this. Thanks Jeremy

Administrator [Syncfusion]
Replied On May 4, 2003 07:21 PM UTC

> How would you set column header alignment automatically in a GridDataBoundGrid. > > I want the header alignment to be the same as the column alignment. > > I've tried doing this in PrepareViewInfo, but it doesn't seem to work. > > The only way I can see to do this is to create a new HeaderBaseStyle, but I'm looking for a more "automated" way of doing this. > > Thanks > Jeremy > > > Did you use the HorizontalAlignment property? This seems to work for me.
private void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
	if(e.ColIndex > 0 && e.RowIndex == 0)
	{
		int field = this.gridDataBoundGrid1.Binder.ColIndexToField(e.ColIndex);
		e.Style.HorizontalAlignment = this.gridDataBoundGrid1.Binder.InternalColumns[field].StyleInfo.HorizontalAlignment;
	}
}

Jeremy Holt
Replied On May 5, 2003 10:09 AM UTC

Clay Sorry - I was being dopey - I had previously jumped out of PrepareViewInfo if e.rowindex=0 Thanks Jeremy

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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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

;