From dbdd003e82da039ee19eabfc1dfcdf5215124ffb Mon Sep 17 00:00:00 2001 From: Vincent Baaij Date: Wed, 18 Sep 2024 14:04:37 +0200 Subject: [PATCH] Chnage height to fit-content so listbox will be smaller if fewer options are supplied --- ...crosoft.FluentUI.AspNetCore.Components.xml | 24 +++++++++++++++++++ .../Components/List/FluentSelect.razor.cs | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml b/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml index e58459dabc..70fcc0edf8 100644 --- a/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml +++ b/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml @@ -1857,6 +1857,7 @@ ColumnOptions UI. This parameter allows you to enable or disable this resize UI.Enable it by setting the type of resize to perform Discrete: resize by a 10 pixels at a time Exact: resize to the exact width specified (in pixels) + Note: This does not affect resizing by mouse dragging, just the keyboard driven resize. @@ -2050,6 +2051,29 @@ + + + Resizes the column width by a discrete amount. + + The column to be resized + The amount of pixels to change width with + + + + + Resizes the column width to the exact width specified (in pixels). + + The column to be resized + The new width in pixels + + + + + Resets the column widths to their initial values as specified with the parameter. + If no value is specified, the default value is "1fr" for each column. + + + Gets or sets the reference to the item that holds this cell's values. diff --git a/src/Core/Components/List/FluentSelect.razor.cs b/src/Core/Components/List/FluentSelect.razor.cs index c7dd201d74..1d79febccd 100644 --- a/src/Core/Components/List/FluentSelect.razor.cs +++ b/src/Core/Components/List/FluentSelect.razor.cs @@ -9,7 +9,7 @@ public partial class FluentSelect : ListComponentBase where TO /// protected virtual MarkupString InlineStyleValue => new InlineStyleBuilder() .AddStyle($"#{Id}::part(listbox)", "max-height", Height, !string.IsNullOrWhiteSpace(Height)) - .AddStyle($"#{Id}::part(listbox)", "height", Height, !string.IsNullOrWhiteSpace(Height)) + .AddStyle($"#{Id}::part(listbox)", "height", "fit-content", !string.IsNullOrWhiteSpace(Height)) .AddStyle($"#{Id}::part(listbox)", "z-index", ZIndex.SelectPopup.ToString()) .AddStyle($"#{Id}::part(selected-value)", "white-space", "nowrap") .AddStyle($"#{Id}::part(selected-value)", "overflow", "hidden")