The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
Hi
I have created a component with members datasource,datamember and a GridBoundColumnsCollection. I can create a gridboundcolumnscollection in design without a GDBG. The only problem I have is that the GridStyleInfo isn''t fully created when I add a new gridboundcolumn to the collection - every property from the GridStyleInfo is Nothing( Object reference not set to an instance of an object.)
How can I add a GridStyleInfo to a gridboundcolumn without using a GDBG ?
ADAdministrator Syncfusion Team February 17, 2006 07:29 PM UTC
Hi Krijn,
not 100% sure if that will help but I looked through the code and I added some code so that it will check whether a grid model is attached to the bound column.
If you have source code you can replace this class in GridBoundColumn.cs
internal class GridBoundColumnStyleInfoIdentity: StyleInfoIdentityBase
{
GridBoundColumn boundColumn;
protected IStyleInfo[] savedBaseStyles = null;
// Cache
public GridBoundColumnStyleInfoIdentity(GridBoundColumn col)
{
this.boundColumn = col;
}
public override void Dispose()
{
savedBaseStyles = null;
boundColumn = null;
base.Dispose();
}
///
public override IStyleInfo[] GetBaseStyles(IStyleInfo thisStyleInfo)
{
if (savedBaseStyles == null && this.boundColumn != null)
{
int level;
GridStyleInfo style = thisStyleInfo as GridStyleInfo;
string baseStyleName = style.HasBaseStyle ? style.BaseStyle : "";
if (boundColumn.Owner == null || boundColumn.Owner.gridModel == null)
{
savedBaseStyles = new GridStyleInfo[0];
}
else
{
GridStyleInfo[] infoMapStyles = boundColumn.Owner.gridModel.BaseStylesMap.GetBaseStylesMapStyles(baseStyleName, out level);
savedBaseStyles = new GridStyleInfo[level];
if (infoMapStyles != null)
Array.Copy(infoMapStyles, 0, savedBaseStyles, 0, level);
}
}
return savedBaseStyles;
}
///
public override void OnStyleChanged(StyleInfoBase style, StyleInfoProperty sip)
{
savedBaseStyles = null;
}
}
Stefan