I have a requirement where in I am using a Custom summary type of UltraGrid.
All the columns in the group by rows are aligned to right by default.
Now I want the text in a column to be left aligned. Is there a property which will help me achieve this.
I have tried the below code which did not work for me.
Please help
Thank You
Hi,
I'm not sure I understand what you are trying to do. It looks like you tried to post a screen shot here but the link is broken so I don't see the image.
If you are trying to align the text inside the summary then you appear to be doing it right - but this will only work if your summaries in the GroupByRow in displayed as cells and not just as raw text.
Thank you for your quick response.
I have re-posted the screen shot.
As you can see in the screen shot, I'm using the GroupByRow and I could see the cell highlighted. But the cells does not align as I want it to be.
Posting the entire code. Please rectify me If I'm wrong.
Dim band As UltraGridBand = Me.myulGrid.DisplayLayout.Bands(0)
Dim summary As SummarySettings = band.Summaries.Add("UNIT", SummaryType.Custom, _ New clsUltraGridSummaryCalculator(), band.Columns("Unit"), SummaryPosition.UseSummaryPositionColumn, Nothing) summary.SummaryDisplayArea = SummaryDisplayAreas.InGroupByRows summary.DisplayFormat = "{0:n2}" summary.Band.Override.CellAppearance.TextHAlign = HAlign.Left 'summary.Appearance.TextHAlign = HAlign.Left 'summary.SummaryPosition = SummaryPosition.Left
Thank You.
Hello Shambu,
Could you please try to attach if possible a small sample project reproducing the above mentioned issue, I will be happy to take a look at it.
Hello Mike Saltzman And Boris Toromanov,
I have attached the sample project to reproduce the issue.
We have the below code written in the initialize layout of the grid to set the Summary text to display the text in the header column of the specific field.
ulGridEstimateDetail.DisplayLayout.Override.GroupBySummaryDisplayStyle = GroupBySummaryDisplayStyle.SummaryCellsulGridEstimateDetail.DisplayLayout.Override.GroupBySummaryValueAppearance.TextHAlign = HAlign.Right
What this does is, it aligns all the columns in the summary to the right, I want to align the text as per the content in the header. That is if it is a numeric value I want to align it to right or else to left.
Thank You,
Shambu Sathyan
Hi Shambu,
Okay, I see the problem, now. The GroupBySummaryValueAppearance (which you hadn't mentioned until now) is considered more specific than the SummarySettings.Appearance. So it takes precedence.
So what you need to do is set the GroupBySummaryValueAppearance on the SummaryValue, not the SummarySettings. The only question then is - when to do it. There's no event for when a new SummaryValue is initialized. But there is an event for when the summary is calculated. So I would do this:
Private Sub ulGridEstimateDetail_SummaryValueChanged(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.SummaryValueChangedEventArgs) Handles ulGridEstimateDetail.SummaryValueChanged Select Case e.SummaryValue.Key Case "UNIT" e.SummaryValue.GroupBySummaryValueAppearance.TextHAlign = HAlign.Left Case Else e.SummaryValue.GroupBySummaryValueAppearance.TextHAlign = HAlign.Right End Select End Sub
This is a bit inefficient, since you will end up setting and re-setting the alignment every time the summary value is recalculated. But it's not that bad, since this will be a no-op after the first time, anyway.
Hello Mike,
Implemented the event and the code you suggested, and it is fulfilling my requirement.