microsoft / microsoft/microsoft-ui-xaml

CalendarDatePicker - Cannot Dynamically Change PlaceholderText property once initially set.

Open
#10,022 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-DateTimePickers team-Controls
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

### Describe the bug

After initially setting the PlaceholderText property, setting the property to another value

### Steps to reproduce the bug

1. Set the PlaceholderText property of a CalendarDatePicker to an initial value.
2. Dynamically change the PlaceholderText property.

Issue - the PlaceholderText is still the initial value instead of the new value.

### Expected behavior

You should be able to dynamically change the PlaceholderText value.

### Screenshots

Initial Property Value

The initial PlaceholderText property value is "PlaceholderText".
![image](https://github.com/user-attachments/assets/d123497a-6144-4189-aee7-e33be2fc8dc8)

As you click the "Change Text" button, a counter is appended to the property.

A TextBlock shows the new property, but the PlaceholderText property remains the same
![image](https://github.com/user-attachments/assets/e719fcb3-0129-4481-bea1-be187d781e78)

After several button clicks:
![image](https://github.com/user-attachments/assets/b065a570-a060-431b-a9e8-d8428f697966)

### 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 code


Change Text


MainWindow.xaml.cs code
public sealed partial class MainWindow : Window
{
public int ICount;
public MainWindow()
{
this.InitializeComponent();

ICount = 0;
}

private void myButton_Click(object sender, RoutedEventArgs e)
{
string sPlaceHolder = "PlaceHolderText-" + ICount++.ToString();

CalendarDatePickerMain.PlaceholderText = sPlaceHolder;

TextBlockMain.Text = sPlaceHolder;
}
}

Attaching sample project
[CalendarDatePickerPlaceHolder.zip](https://github.com/user-attachments/files/17079967/CalendarDatePickerPlaceHolder.zip)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the attached sample project and reviewing MainWindow.xaml and MainWindow.xaml.cs, where CalendarDatePicker.PlaceholderText is set and changed on button clicks. Trace the CalendarDatePicker placeholder behavior and verify that the displayed placeholder updates after each assignment, matching the TextBlock value.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.