Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add ControlExtensions.Icon support to TextBox #1288

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

eriklimakc
Copy link
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):

Copy link

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

@@ -222,6 +222,14 @@ public static class ControlExtensions

#endregion

private static void OnIconChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is TextBox textBox)
Copy link
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
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
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
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.");
}
}

doc/material-controls-extensions.md Outdated Show resolved Hide resolved
Copy link

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