You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MainWindow.xaml.cs:
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace Disabled_Controls
{
///
/// An empty window that can be used on its own or navigated to within a Frame.
///
public sealed partial class MainWindow : Window
{
private bool BoolEnabledState;
Describe the bug
Controls are not visible when disabled, when the are placed on a container with a white background.
For most controls, this can be fixed by setting the control's BackgroundDisabled color in a custom dictionary.
However, this fix does not work for the TextBox type controls, specifically AutoSuggestBox, NumberBox, PasswordBox and TextBox.
Steps to reproduce the bug
I am including an app that demonstrates the issue - see screenshots.
The app shows 5 controls with the left most button disabling/enabling the other 4 controls.
Clicking the "Click Me" button disables the other 4 controls, and the 2 controls on the right disappear.
Clicking the same button enables the other 4 controls and the 2 controls on the right.
Note that these are the custom dictionary entries for the 4 controls to set their Disabled Background Colors:
Expected behavior
When disabled, controls background should change to what is configured in custom dictionary instead of disappearing.
Screenshots
Program start up:
Disabling controls - 2 controls on right disappear:
Re-enabling controls - 2 controls on right reappear:
NuGet package version
Windows App SDK 1.6.0: 1.6.240829007
Packaging type
Unpackaged
Windows version
Windows 10 version 22H2 (19045, 2022 Update)
IDE
Visual Studio 2022
Additional context
Below are the main xaml and cs files.
Attaching entire project in zip file
Disabled Controls.zip
MainWindow.xaml
MainWindow.xaml.cs:
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace Disabled_Controls
{
///
/// An empty window that can be used on its own or navigated to within a Frame.
///
public sealed partial class MainWindow : Window
{
private bool BoolEnabledState;
}
The text was updated successfully, but these errors were encountered: