✅ Cannot Get Rid Of Individual Borders On TextBox Avalonia
CreateNewUserView.axaml: https://pastebin.com/2i7GCfCs
For the life of me, I cannot figure out why each TextBox has its own individual border when they aren't wrapped with a border. Can anyone help? Thanks
9 Replies
I know in the image it doesn't look like it, but if I change the background color of the TextBox to darkgray or something lighter and with having the TextBox's BorderBrush set to Transparent, you'll notice that it's individual borders like I did
@Mekasu0124 can you supply the code for your view model class as well?
@Mekasu0124 under styles you’re adding a style selector for Border. That’s gonna apply to anything with a border, including text boxes. If you want to target a border for a specific kind of object you would need to specify that in the style.
thank you so much ❤️
For example, if you just want to target the border on grid elements, you can do this:
<Style Selector="Grid > Border">
Also, if you don’t necessarily want to apply a style to every instance of an element, style classes can be very helpful.
https://docs.avaloniaui.net/docs/basics/user-interface/styling/style-classes
Style Classes | Avalonia Docs
You can assign an Avalonia UI control one or more style classes, and use these to guide style selection. Style classes are assigned in a control element using the Classes attribute. If you want to assign more than one class, then use a space-separated list.
this is interesting to know. I'll have to remember this.
yea I use classes nearly all the time. I just couldn't figure that one thing out lol