Skip to content

chore: Add ControlExtensions.Icon support to TextBox#1288

Draft
erikvilima wants to merge 2 commits into
masterfrom
dev/ERLI/1286-TextBox-Icons
Draft

chore: Add ControlExtensions.Icon support to TextBox#1288
erikvilima wants to merge 2 commits into
masterfrom
dev/ERLI/1286-TextBox-Icons

Conversation

@erikvilima

Copy link
Copy Markdown
Contributor

GitHub Issue: #1286

PR Type

What kind of change does this PR introduce?

  • Bugfix

Description

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

Internal Issue (If applicable):

@github-actions

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-rock-0cfebe70f-1288.eastus2.azurestaticapps.net


private static void OnIconChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is TextBox textBox)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why constraint it to TextBox only? the target property accept any Control as recipient?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But only TextBox supports LeadingIcon/Command/IsVisible, right?

In that case we should probably spit out a warning if someone is trying to set those properties on things other than a TextBox

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I use System.Diagnostics.Debug.WriteLine("...") for the warning?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used d.Log().LogWarning("...")

private static void WarnNotSupportedProperty(DependencyObject d, string propertyName)
{
if (d is not TextBox)
{
d.Log().LogWarning($"Warning: {propertyName} is only supported on TextBox controls.");
}
}

Comment thread doc/material-controls-extensions.md Outdated
@github-actions

Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://salmon-rock-0cfebe70f-1288.eastus2.azurestaticapps.net

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants