Open johnt-star opened 1 month ago
Not sure if this is a bug or by design, but the TextAlignment enumeration used by TextBlock contains the duplicate entries.
Using Enum.GetValues shows there are 7 entries in total.
There are 2 entries labelled Left and 2 entries Labelled Right.
Screen capture below lists all entries.
See attached code.
Use Enum.GetValues to retrieve and display TextAlignment members.
Entries should have unique names in order to distinguish between the entry's behavior.
This is the list showing the duplicate names:
This is a breakpoint in the code showing duplicates. Note that the entry "Right" shows up as "End", but is still duplicated.
Windows App SDK 1.6.0: 1.6.240829007
Packaged (MSIX)
Windows 10 version 22H2 (19045, 2022 Update)
Visual Studio 2022
MainWindow.xaml <?xml version="1.0" encoding="utf-8"?> <Window x:Class="TextBlockAlignment.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:TextBlockAlignment" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> <TextBlock Name="TextBlockMain"></TextBlock> <ListView Name="ListViewMain"></ListView> </StackPanel>
MainWindow.xaml.cs public sealed partial class MainWindow : Window { public MainWindow() { this.InitializeComponent();
DisplayTextAlignment(); } private void DisplayTextAlignment() { int iIdx; int iCount; Array arTextAlignment; ListViewItem listViewItem; // Get array of enums arTextAlignment = Enum.GetValues(typeof(TextAlignment)); iCount = arTextAlignment.Length; for (iIdx = 0; iIdx < iCount; ++iIdx) { listViewItem = new ListViewItem { Content = arTextAlignment.GetValue(iIdx).ToString(), }; ListViewMain.Items.Add(listViewItem); } }
Attaching project TextBlockAlignment.zip
Describe the bug
Not sure if this is a bug or by design, but the TextAlignment enumeration used by TextBlock contains the duplicate entries.
Using Enum.GetValues shows there are 7 entries in total.
There are 2 entries labelled Left and 2 entries Labelled Right.
Screen capture below lists all entries.
Steps to reproduce the bug
See attached code.
Use Enum.GetValues to retrieve and display TextAlignment members.
Expected behavior
Entries should have unique names in order to distinguish between the entry's behavior.
Screenshots
This is the list showing the duplicate names:
This is a breakpoint in the code showing duplicates. Note that the entry "Right" shows up as "End", but is still duplicated.
NuGet package version
Windows App SDK 1.6.0: 1.6.240829007
Packaging type
Packaged (MSIX)
Windows version
Windows 10 version 22H2 (19045, 2022 Update)
IDE
Visual Studio 2022
Additional context
MainWindow.xaml <?xml version="1.0" encoding="utf-8"?> <Window x:Class="TextBlockAlignment.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:TextBlockAlignment" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
MainWindow.xaml.cs public sealed partial class MainWindow : Window { public MainWindow() { this.InitializeComponent();
Attaching project TextBlockAlignment.zip