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.
Syncfusion Feedback

Header alignment

Thread ID:

Created:

Updated:

Platform:

Replies:

4224 May 4,2003 05:33 AM May 5,2003 06:09 AM Windows Forms 2
loading
Tags: GridControl
Jeremy Holt
Asked On May 4, 2003 05:33 AM

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 03:21 PM

> 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 06:09 AM

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.

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

;