I want to change the ColumnsCount property value at runtime, for example, based on the Excel files that the app is loading.
===
TELERIK EDIT:
A possible workaround is to recreate the Spreadsheet component. The downside will be a minor UI flicker. Alternatively, set ColumnsCount to a small value like 1. In this way the component will display only the existing columns in the opened file.
<TelerikNumericTextBox @bind-Value="@SpreadsheetColumnsCount"
Min="0" Max="999"
Width="80px" />
<TelerikButton OnClick="@OnButtonClick">Apply ColumnsCount</TelerikButton>
@if (SpreadsheetVisible)
{
<TelerikSpreadsheet Data="@SpreadsheetData"
ColumnsCount="@SpreadsheetColumnsCount">
</TelerikSpreadsheet>
}
@code {
private byte[]? SpreadsheetData { get; set; }
private int SpreadsheetColumnsCount { get; set; } = 10;
private bool SpreadsheetVisible { get; set; } = true;
private async Task OnButtonClick()
{
SpreadsheetVisible = false;
await Task.Delay(1);
SpreadsheetVisible = true;
}
}