Describe the bug
When DateTimePickerPanel.ItemHeight is changed at runtime through a dynamic resource, the existing picker items keep stale layout state.
After changing DatePickerFlyoutPresenterItemHeight, the selected item height and the DatePicker popup position can be incorrect on the next open. The layout becomes correct only after another interaction or another layout update.
This is reproducible with the Fluent theme.
To Reproduce
<StackPanel x:Name="DatePickerHeightDemo"
Margin="8"
Spacing="8">
<TextBlock Classes="h2">DatePicker dynamic item height (Fluent theme)</TextBlock>
<TextBlock Text="Open and close the picker, change the height, then open it again." />
<DatePicker x:Name="DynamicHeightDatePicker" VerticalContentAlignment="Center" />
<Button Click="OnDatePickerHeightChanged">Change item height (40 / 60)</Button>
<TextBlock x:Name="DatePickerHeightValue" Text="Current item height: 40" />
</StackPanel>
private bool _isLargeDatePickerHeight;
private void OnDatePickerHeightChanged(object? sender, RoutedEventArgs e)
{
_isLargeDatePickerHeight = !_isLargeDatePickerHeight;
var height = _isLargeDatePickerHeight ? 60d : 40d;
DatePickerHeightDemo.Resources["DatePickerFlyoutPresenterItemHeight"] = height;
DatePickerHeightDemo.Resources["DatePickerFlyoutPresenterHighlightHeight"] = height;
DatePickerHeightValue.Text = $"Current item height: {height:0}";
}
Expected behavior
No response
Avalonia version
12.1.2
OS
No response
Additional context
No response
Describe the bug
When
DateTimePickerPanel.ItemHeightis changed at runtime through a dynamic resource, the existing picker items keep stale layout state.After changing
DatePickerFlyoutPresenterItemHeight, the selected item height and the DatePicker popup position can be incorrect on the next open. The layout becomes correct only after another interaction or another layout update.This is reproducible with the Fluent theme.
To Reproduce
Expected behavior
No response
Avalonia version
12.1.2
OS
No response
Additional context
No response