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

Added the HorizontalIconAlignment property to the button. #1117

Closed
wants to merge 9 commits into from

Conversation

m0lDaViA
Copy link
Contributor

@m0lDaViA m0lDaViA commented Jun 10, 2024

Added the HorizontalIconAlignment property to the button.
You can now choose, if you want to show the icon left or right to the content.

Pull request type

Please check the type of change your PR introduces:

  • Update
  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Other information

…u want to show the icon left or right to the content.
@m0lDaViA m0lDaViA requested a review from pomianowski as a code owner June 10, 2024 08:39
@github-actions github-actions bot added controls Changes to the appearance or logic of custom controls. styles Topic is related to styles PR Pull request dotnet labels Jun 10, 2024
@@ -13,16 +13,16 @@ namespace Wpf.Ui.Controls;
/// </summary>
/// <example>
/// <code lang="xml">
/// &lt;ui:Button
Copy link
Member

Choose a reason for hiding this comment

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

Examples should not use special characters
https://wpfui.lepo.co/api/Wpf.Ui.Controls.Button.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because? I mean even vs is using it totally fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh and btw & is a special character :)

set => SetValue(HorizontalIconAlignmentProperty, value);
}

public enum HorizontalIconAlignments
Copy link
Member

Choose a reason for hiding this comment

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

Missing docs for public API.

set => SetValue(HorizontalIconAlignmentProperty, value);
}

public enum HorizontalIconAlignments
Copy link
Member

Choose a reason for hiding this comment

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

I would extract it to a separate file

@Jay-o-Way
Copy link

Jay-o-Way commented Jun 11, 2024

Hm, the word "alignment" usually sounds like it is placed inside of a space. Like: text on a page is aligned inside/between the borders of the page. Not next to the page.
Here, is more like a position relative to something else.

@m0lDaViA
Copy link
Contributor Author

Hm, the word "alignment" usually should like it is placed inside of a space. Like: text on a page is aligned inside/between the borders of the page. Not next to the page. Here, is more like a position relative to something else.

But it isn't relative, that's the difference.

@Jay-o-Way
Copy link

What I mean is, the icon is placed to the left/right of the content/text. Therefore I think "HorizontalIconPlacement" would be a good (or even more accurate) wording.

By the way, I assume this works well in RTL language?

@m0lDaViA
Copy link
Contributor Author

What I mean is, the icon is placed to the left/right of the content/text. Therefore I think "HorizontalIconPlacement" would be a good (or even more accurate) wording.

By the way, I assume this works well in RTL language?

In this case I followed the standard alignment that MS uses.

m0lDaViA added 2 commits June 21, 2024 02:45
1. FonIcon/SymbolIcon markup now fully supports fontsize.
Setting the fontsize in the markup will be prioritized over inheriance.

2. Using Content="Text" in the UiButton class can now format the string from inheritance.
Right now it is not possible to do this for the Button class as it breaks the direct string rendering.
Formating text in seperate child elements such as TextBlock does not inheritance as it is not possible to get both working right now.
So better we use this method to format strings because we can alwasys format any TextBlock on it's own inside the UiButton.

3. Moved IconAlignment into IconElement folder and added VerticalIconAlignment as possibility.
Docs added (check them, maybe you don't like them)

4. Added a border to the Slider style for visual value feedback.

5. Refactored the SystemThemeManager class.
Using SystemUsesLightTheme is unnecessary since the app theme is the only one necessary variable we need.
If the system uses light theme withouth seperating the app theme, SystemUsesLightTheme will always return 1 and vice versa.
We should also take into account if people change their app theme separately and base it on that one.
@github-actions github-actions bot added themes Topic is related to managing themes icons Fonts and icons updates labels Jun 21, 2024
@m0lDaViA m0lDaViA requested a review from pomianowski June 21, 2024 00:51
@m0lDaViA
Copy link
Contributor Author

#1120 & #887 can check the last commit.

1. Added AdditionalControls property:
You can now add additional buttons with the same default size or add customizied controls.
Button default style example:
```csharp
<ui:Button Width="44"
           Height="30"
           BorderThickness="0"
           Background="Transparent"
           Icon="{ui:SymbolIcon DarkTheme24,
                                False,
                                15}"
           />```

2. Header remains the same.

3. Window is now resizable if you use a TitleBar:
You can now (finally!) resize the window if you use the TitleBar! This was the most reason why i switched here from messages to events. Messages are basically not necsassary for the titlebar.

4. ActionsOverride:
You can now override every default button (Help, Minimize, Maximize and Close) contained in the TitleBar.
Before you could create a RoutedEvent for the close event and performe actions in there but you could never cancel the close method as it was a seperated event inside the TitleBar called after the override action.
Now you can!

4. Added boolean UseTrayMenu:
If UseTrayMenu on close click the application now hides instead the window of closing it. Add your tray menu and your boolean and you are good to go.

5. DragMove from maximized window is now smoother.
@github-actions github-actions bot added navigation Changes to navigation related controls. titlebar Titlebar updates labels Jun 24, 2024
@m0lDaViA
Copy link
Contributor Author

I don't know why, but my vs is bugged rn. I cannot create visible styles and my formatter does instead of formatting only opened files all .xaml files.
Sorry for that.

@m0lDaViA m0lDaViA closed this Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
controls Changes to the appearance or logic of custom controls. dotnet icons Fonts and icons updates navigation Changes to navigation related controls. PR Pull request styles Topic is related to styles themes Topic is related to managing themes titlebar Titlebar updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants