I need to programmatically pin the first four colums...I'd also like to do this without showing the pins, i dont want the user to pin/unpin, i just want the first four columns not to go away when i scroll to the right...this should be simple and i cant find it anywhere.
UltraWinGrid
thanks,
lanierhall said:is there any reason why the InitializeLayout event never fires?
The event fires when you set the DataSource on the grid. If it's not firing, then my only guess is that it's not hooked properly, or you are not hooking the event until after you have already set the DataSource.
is there any reason why the InitializeLayout event never fires? The only layout i've been able to modify has been the DisplayLayout property
I was able get this working by modifying these values in my constructor
grid.DisplayLayout.UseFixedHeaders = true;
grid.DisplayLayout.Override.FixedHeaderIndicator = FixedHeaderIndicator.None
for (int i = 0; i < 4; i++){ grid.DisplayLayout.Bands[0].Columns[i].Header.Fixed = true;}
But I still don't understand why InitializeLayout event never fires
i had this code and a breakpoint and it never triggered
this line does execute:view.Grid.grid.InitializeLayout += new InitializeLayoutEventHandler(grid_InitializeLayout);
but this method in the same class never gets called:
void grid_InitializeLayout(object sender, InitializeLayoutEventArgs e)
{
e.Layout.UseFixedHeaders = true;
e.Layout.Override.FixedHeaderIndicator = FixedHeaderIndicator.None;
for (int i = 0; i < 4; i++)
e.Layout.Bands[0].Columns[i].Header.Fixed = true;
}
private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e) { e.Layout.UseFixedHeaders = true; e.Layout.Override.FixedHeaderIndicator = FixedHeaderIndicator.None; for (int i = 0; i < 4; i++) { e.Layout.Bands[0].Columns[i].Header.Fixed = true; } }
I get the pinning idea as opposed to fixing the column width. I was just trying to find out if you have succeed in pinning columns programatically but just cannot hide the Pin button.
I have only done this through the UltraGrid designer. But everything else I have tried so far works in the same in the designer as it does programatically.
In the designer you need to set UltraGrid.DisplayLayout.Bands[0].Override.FixedHeaderIndicator to None to hid the Pin button. You also need to set the UltraGrid.DisplayLayout.UseFixedHeaders to true.
I think that should work for you too.
I don't want the column widths to be Fixed, I want the columns to be pinned, so that when I scroll right through my 20 columns in my grid, the first four columns stay visible the whole time.
this is similar to the 'freezing' a row or column in Excel