Mekasu0124
Explore posts from serversAccessing Function from Nested UI File - Avalonia
Ok so I have the following file structure for my Avalonia MVVM project
In my FileMenu.axaml file I have a menu option
I know to bind it to a command I would do
however, the exit function is in my MainWindowViewModel. So I have two questions.
1. Is it ok if I put the exit command in the FileMenu.axaml.cs file to exit the program?
2. If not, do I create a ViewModel file in the same directory as the FileMenu.axaml file and then call that code behind for all of my nested menu options?
either way, if it's ok to stay in the MainWindowViewModel, then how do I properly bind to it? I remember in a Todo tutorial they did something like a this.Something.bind.x or something like that. Let me see if I can find it
17 replies
✅ How to use a UserControl inside of a Window?
So I've moved part of the menu bar at the top of the screen to another UserControl file as my menu bar has a lot of options so I'm breaking it up. As the code above currently sits, I have a blank screen with an arrow in the top-right corner, but nothing else. I used the reference from this stack overflow comment to put in the
xmlns:uc=""
and the <uc:FileMenu />
. Here is the full code for the <uc:FileMenu />
page that is in Views/MenuBar. I'm just not sure what I'm doing wrong. Thanks12 replies
✅ How to work with Python A.I.'s
Ok, although I'm no where near ready to start writing my first line of code, I do want to get an idea of what I'm getting myself into. I'm building the A.I. in python and I'll be building an Avalonia desktop application that will interact with the A.I.
What I'm wondering is if there are any libraries, or other, that anyone recommends that would go great with this idea? Thanks.
38 replies
✅ Reducing code to separate UserControls for easier readability Avalonia
code: https://pastebin.com/zEFZNhip
I'm wanting to learn how to break some of this screen down into a reusable UserControl that I can call in other places as well, but I can't get past creating the
/Views/UserControls
directory and creating a new user control as I'm not sure what part(s) can be broken down. Thanks1 replies
How do I use models from Project A in Project B?
Lets say I have a models folder with a few models in it inside of Project A and I've created another project under the same
.sln
called Project B. I instead of having to create duplicate models between both projects, I want to use the models with Project A's models folder inside of Project B. I tried
but I get a resolve error basically saying it can't find it, but the folder structure is
. Thanks in advance.32 replies
How To Set Vertical Snap Points on Avalonia ScrollViewer
I'm curious to know if this is such a thing. Basically what I'm wanting to do is when the user clicks the buttons to scroll, or uses their mouse wheel, it will either auto scroll or "jump" with a scroll animation to the nth child within each of the borders. Is there a way I can name the border's and achieve this? Thanks.
1 replies
✅ Converting From ReactiveUI to Community Toolkit
ok so I'm good on how to use Community Toolkit in the ViewModel, however, I have no idea how it's used for screen navigation in the MainWindowViewModel and I can't find a tutorial online or a youtube video explaining it. Does anyone have anything?
1 replies
✅ Catching different errors using System.Data.SQLite
so I'm wanting to write a custom class that error handles my database. For example:
I would somehow (idk how) use the class within the code above for adding a new user to the database. In the create database function, the Username field is unique. A user tries to create a new account with a username that already exists. I would like for the process to be something like
1. user clicks create user button call database function
2. database tries to save -> send error to custom error handler class
3. function for unique errors sends back some type of value to the View for the user to tell them that the username already exists and to try again
How would I go about doing this? I wanted to do a custom class so that I could call the error class anywhere I needed throughout my database file and be able to still have the program act accordingly.
30 replies
✅ Styling Avalonia DatePicker Control
My Code: https://pastebin.com/v057vZCS
Avalonia Code For DatePicker Style: https://pastebin.com/QewxMCD9
I am trying to style this DatePicker, and I'm doing it as it's own UserControl so that I can call it when needed. I want it's style, whether opened or closed, to be with a black background
{DynamicResource Background}
, specific value hex of blue {DynamicResource BorderColor}
for the border and for the spacers in between the day/month/year values whether open or close, and darkgray text {DynamicResource FontColor}
whether opened or closed, but I can't figure it out. Any help is appreciated. Thank you.3 replies
✅ Allow user to select profile image avalonia
https://docs.avaloniaui.net/docs/concepts/services/storage-provider/file-picker-options
I found this on the docs, but I think I'm looking in the wrong place. On the create new user screen in my application, I want to have a part where the user can select a file from their local computer to set as their profile image, however, I'm not having much luck finding any examples, or other users on like Stack Overflow who are trying to do the same thing. Thanks in advance.
16 replies
✅ How To Get Button To Show Another Screen Avalonia
LoginViewModel: https://pastebin.com/V6dia5A0
MainWindowViewModel: https://pastebin.com/cXSuA4wM
I'm trying to get my ForgotPassword and ReturnCreateNewUser buttons to show the screens equivalent to them instead of having to return some value back to the MainWindowViewModel to navigate it. I just can't get it to work. Any ideas are welcome. Thanks in advance
1 replies
✅ Creating a ToolTip on a TextBox Avalonia
LoginView.axaml: https://pastebin.com/AX548bUA
I'm trying to create a ToolTip on the TextBox's on the screen, however, I keep getting
but it doesn't show the list, and it's duplicated twice, once for each TextBox, so what am I doing wrong? Thanks.
2 replies
✅ make function sleep without freezing ui avalonia
ReturnUser
model, I can't figure out what to return in the if/else if
clauses.
2. My second issue is that when i click the Exit button, it's almost immediate. It takes a second or two and then the window closes, but then if I just leave username and password blank and click login, it takes nearly 6 seconds to figure whatever it needs to out and then it displays that the login was successful ...
3. which leads into #3 before #1 became an issue, I did have it to where the else clause was outside of the if statment and not in an else clause so that the code would execute if the check systems didn't fail, however, I think there was a problem with my check system. This is a link to the copy of the code that comes before #1 being an issue https://pastebin.com/jsb8nsqA
I'm not really sure what to do. I would like to keep the code I had before #1 became an issue as I was working on cleaning it up and making it better if we could go that route with this code https://pastebin.com/jsb8nsqA
MainWindowViewModel.cs (for reference): https://pastebin.com/R8e77kDa57 replies