/// <summary>
/// Adds or updates given range.
/// Updates range only when existing range with given start position is found
/// </summary>
/// <param name="newRange"></param>
public void UpdateOrAdd(Range newRange)
{
if (newRange.Equals(Range.Empty))
{
throw new ArgumentException("Range can not be empty");
}
Range?index = this.SpannedRangesCollection.FindRangeWithStart(newRange.Start);
if (index == null)
{
this.SpannedRangesCollection.Add(newRange);
}
else
{
//[email protected]: On trying to Update SpannedCellRangesController passes only start range. Hence oldRange is not the actual range which should be removed.
/*scenerio : 1. Set a Cell's columnspan to 1. then after loading entire grid change the span to 2. Again after loading entire grid change the span to 3.
* Now try making all these cells null individually.(In UIGridExtender set displayController = null) Result - Crash*/
Range?spannedRange = this.SpannedRangesCollection.FindRangeWithStart(newRange.Start);
if (spannedRange.HasValue)
{
this.SpannedRangesCollection.Update(spannedRange.Value, newRange);
}
}
}