C
C#4mo ago
Mekasu0124

✅ 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
Pastebin
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
No description
9 Replies
Mekasu0124
Mekasu01244mo ago
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
Mayka
Mayka4mo ago
@Mekasu0124 can you supply the code for your view model class as well?
Mayka
Mayka4mo ago
@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.
Mekasu0124
Mekasu01244mo ago
thank you so much ❤️
Mayka
Mayka4mo ago
For example, if you just want to target the border on grid elements, you can do this: <Style Selector="Grid > Border">
Mayka
Mayka4mo ago
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.
Mekasu0124
Mekasu01244mo ago
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