Skip to content

Commit

Permalink
Fix Listbox text truncation when text is scaled up (#1397)
Browse files Browse the repository at this point in the history
## Description
This change updates the Width set on ListBox to be MinWidth instead.

## Motivation and Context
This fixes an accessibility issue in WinUI3 Gallery, where ListBox would
truncate longer text when text scaling is sized up.

## How Has This Been Tested?
Ad-hoc testing

## Screenshots (if appropriate):

## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

---------

Co-authored-by: Christine Yan <[email protected]>
  • Loading branch information
christineyan4 and Christine Yan authored Nov 3, 2023
1 parent dc932c4 commit 10e7665
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions WinUIGallery/ControlPages/ListBoxPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
<StackPanel>
<local:ControlExample x:Name="Example1" HeaderText="A ListBox with items defined inline and its width set.">
<local:ControlExample x:Name="Example1" HeaderText="A ListBox with items defined inline and its minimum width set.">
<local:ControlExample.Example>
<StackPanel>
<ListBox x:Name="ListBox1" SelectionChanged="ColorListBox_SelectionChanged" Width="200" HighContrastAdjustment="Auto">
<ListBox x:Name="ListBox1" SelectionChanged="ColorListBox_SelectionChanged" MinWidth="200" HighContrastAdjustment="Auto">
<x:String>Blue</x:String>
<x:String>Green</x:String>
<x:String>Red</x:String>
Expand All @@ -28,7 +28,7 @@
</local:ControlExample.Example>
<local:ControlExample.Xaml>
<x:String xml:space="preserve">
&lt;ListBox SelectionChanged="ColorListBox_SelectionChanged" Width="200"&gt;
&lt;ListBox SelectionChanged="ColorListBox_SelectionChanged" MinWidth="200"&gt;
&lt;x:String&gt;Blue&lt;x:String&gt;
&lt;x:String&gt;Green&lt;x:String&gt;
&lt;x:String&gt;Red&lt;x:String&gt;
Expand Down

0 comments on commit 10e7665

Please sign in to comment.