Exemplo n.º 1
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (baseModule == null)
            {
                baseModule = await JSRuntime !.InvokeAsync <IJSObjectReference>("import", BasePath);
            }

            if (firstRender)
            {
                await OnRowDidMount.InvokeAsync(this);
            }

            try
            {
                if (columnMeasureInfo != null && columnMeasureInfo.Index >= 0 && cellMeasurer.Id != null)
                {
                    Action <double>?method = columnMeasureInfo.OnMeasureDone;
                    Rectangle?      size   = await baseModule.InvokeAsync <Rectangle>("measureElementRect", cancellationTokenSource.Token, cellMeasurer);

                    method?.Invoke(size.Width);
                    columnMeasureInfo = null;
                    Debug.WriteLine($"rerendering {ItemIndex} because of column measurement");
                    await InvokeAsync(StateHasChanged);
                }
            }
            catch (Exception)
            {
            }

            await base.OnAfterRenderAsync(firstRender);
        }
Exemplo n.º 2
0
        public void MeasureCell(int index, Action <double> onMeasureDone)
        {
            DetailsRowColumn <TItem>?column = Columns.ElementAt(index);

            column.MinWidth        = 0;
            column.MaxWidth        = 999999;
            column.CalculatedWidth = double.NaN;

            columnMeasureInfo = new ColumnMeasureInfo <TItem> {
                Index = index, Column = column, OnMeasureDone = onMeasureDone
            };
            InvokeAsync(StateHasChanged);
        }
Exemplo n.º 3
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (firstRender)
            {
                await OnRowDidMount.InvokeAsync(this);
            }

            if (columnMeasureInfo != null && columnMeasureInfo.Index >= 0 && cellMeasurer.Id != null)
            {
                Action <double>?method = columnMeasureInfo.OnMeasureDone;
                Rectangle?      size   = await JSRuntime.InvokeAsync <Rectangle>("FluentUIBaseComponent.measureElementRect", cellMeasurer);

                method(size.Width);
                columnMeasureInfo = null;
                await InvokeAsync(StateHasChanged);
            }

            await base.OnAfterRenderAsync(firstRender);
        }
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            baseModule = await JSRuntime.InvokeAsync<IJSObjectReference>("import", BasePath);

            if (firstRender)
            {
                await OnRowDidMount.InvokeAsync(this);
            }

            if (columnMeasureInfo != null && columnMeasureInfo.Index >= 0 && cellMeasurer.Id != null)
            {
                Action<double>? method = columnMeasureInfo.OnMeasureDone;
                Rectangle? size = await baseModule.InvokeAsync<Rectangle>("measureElementRect", cellMeasurer);
                method?.Invoke(size.Width);
                columnMeasureInfo = null;
                await InvokeAsync(StateHasChanged);
            }

            await base.OnAfterRenderAsync(firstRender);
        }