-
Notifications
You must be signed in to change notification settings - Fork 31
chore: Add ControlExtensions.Icon support to TextBox #1288
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -29,7 +29,7 @@ public static class ControlExtensions | |||||||||||||||
"Icon", | ||||||||||||||||
typeof(IconElement), | ||||||||||||||||
typeof(ControlExtensions), | ||||||||||||||||
new PropertyMetadata(default)); | ||||||||||||||||
new PropertyMetadata(default, OnIconChanged)); | ||||||||||||||||
|
||||||||||||||||
[DynamicDependency(nameof(SetIcon))] | ||||||||||||||||
public static IconElement GetIcon(Control obj) => (IconElement)obj.GetValue(IconProperty); | ||||||||||||||||
|
@@ -222,6 +222,14 @@ public static class ControlExtensions | |||||||||||||||
|
||||||||||||||||
#endregion | ||||||||||||||||
|
||||||||||||||||
private static void OnIconChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | ||||||||||||||||
{ | ||||||||||||||||
if (d is TextBox textBox) | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why constraint it to There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should I use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used Uno.Themes/src/library/Uno.Material/Extensions/ControlExtensions.cs Lines 247 to 253 in fcbeafc
|
||||||||||||||||
{ | ||||||||||||||||
textBox.SetValue(LeadingIconProperty, e.NewValue); | ||||||||||||||||
} | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
private static void OnElevationChanged(DependencyObject element, DependencyPropertyChangedEventArgs e) | ||||||||||||||||
=> SurfaceTintExtensions.OnElevationChanged(element, (int)e.NewValue); | ||||||||||||||||
|
||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.