-
Notifications
You must be signed in to change notification settings - Fork 105
Add HyperlinkButton theming support #450
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
Add HyperlinkButton theming support #450
Conversation
|
TODO: after PR should update wiki page about brushes with "when added" |
|
@appleneko2001 welcome back :) Can you move dialog fixes to separate PR, please? |
ya its been a long time i know sorry for such wait
Based on which branch? i have been a while not following this repository quite losing the way lol |
|
Based on |
Got it im doing it |
|
could you please review this pr at least? there is not that much changes tbh @SKProCH |
| // Used for memorise which hyperlink button clicked (or just say, visited) | ||
| #region AttachedProperty : IsClicked | ||
|
|
||
| public static readonly AvaloniaProperty<bool?> IsClickedProperty = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of this attached property, if we have an IsVisited inside a HyperlinkButton itself?
SKProCH
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hyperlink additions looks good (except for attached property)
Yea i know but its used for memorise visited status, which auto-saves visited state. It can be used not only hyperlink, but also any control that derives on |
I'm not really sure that anyone will need it in this version (especially since it is not used anywhere, even in the style for HyperlinkButton). Avalonia has a large selection of buttons, are you sure that users will need this property (and that we will support it for all existing buttons)? I'd rather not complicate things and not create unnecessary properties that will be needed by a very limited number of people, but maybe you have a different opinion? |
Well if you dont like it i can delete that and try to auto-binding Technically if you give it
Do we have other active member for this conversation? |
|
It's not really about "like it or not", I'm thinking more about the possible scope of application. Are you planning to make some modifications to existing button styles to take ButtonAssist.IsClicked into account? It's just that it's not used anywhere in the current implementation, and I'm not sure that it's worth including in the current PR. Maybe it's worth putting it in a separate PR, which will also show some use of this property? I'm just saying that this increases our public API, and I don't really want to just add properties there that have no use - it will be difficult to remove them (without fear of breaking user code). I don't see any extensive use of this property, since HyperlinkButton already has everything it needs, and for other buttons it is most often not needed, besides, it's not very clear how it should look (since there is no such thing in any material guidelines). What I mean is that we either need to come up with some specific useful application for it and display it in styles (like other properties that we create, for example TextBox.Hints), or not add it, because those few people who will need it are not the majority, we are unlikely to be able to guess their use case, and they can add it themselves.
Probably not, but I have never seen a request for such functionality anywhere |
|
How do you think then, if I put this thing to the wiki page as a extra feature, instead of including this attached property to the library ? I just think this thing would help to less trouble while implementing, like its already implemented and you dont have to worry about it. Also, I would want to expose For example, you have used internal static void RaiseRipplePrivate(Control c)
{
// Try to find first RippleEffect control with name PART_Ripple
var visual = c
.GetVisualDescendants()
.FirstOrDefault(a => a is RippleEffect && a.Name == "PART_Ripple");
// if such control not exist or mouse is over on it
if(visual is not RippleEffect effect || effect.IsPointerOver)
return;
effect.RaiseRipple();
}2025-05-02.03-20-42.mp4 |
|
P.S. I want to add a little to my previous answer: I am not against adding something that has a non-zero chance of being used and is implemented. That is, if you make this property usable in styles (for example, implement some change for buttons styles when they are already pressed), then it will be generally fine.
I don't really see how to do this, because the property itself will not be associated with existing styles, i.e. the user will probably add it along with style changes, which he will also make himself.... Therefore, it is probably not very connected with Material.Avalonia, rather it is simply "what can be done with attached property", but if you really want to put it on the wiki... Okay
Usually ripple triggers as a feedback for pointer pressing... But I don't mind about extending such things, you can do it in the new PR if you want. |
|
@appleneko2001 i can separate PRs by myself, if you want |
Nah I'm just thinking how to do it better than making more troubles, since this project isn't my personal project anymore, its for the community, I should take some others opinions too before do anything break changes. Thats why I said we need some others active members to review this question, and also I have choose submit changes via PR with reviews to make the changes transparent.
Ah thats because ripple effects are not only for feedback for pointer press, but also pretty helpful for mentioning users where to take the attention Such thing or ideas are already existed in
But yea since our Ripple effect are working different it couldn't be done same as their demo looks like, but at least it does exist for such use |
Yea I leave this power to your hand instead @SKProCH , the |
This reverts commit 2351052.

Details
Add Hyperlink themes, which it doesn't existed before.
Static Resource key:
MaterialHyperlinkButtonCommit: d81e934
Dark theme

Light theme

Adds two new brushes:
MaterialHyperlinkBrushbrush for initial state hyperlinksMaterialHyperlinkVisitedBrushbrush for visited (clicked) state hyperlinksAdds two new colours:
MaterialHyperlinkColorinitial hyperlink colourMaterialHyperlinkVisitedColorvisited hyperlink colourCommit: 71fd15e
Tips: those colours have different between light and dark theme
Also, this PR will update Demo buttons page