✅ File Searcher in Avalonia
Hey, I am just asking how to make a Open File Dialog so that it functions just like the one from Windows Forms, but how can I do that - I don´t want to make it so it only works on linux, I just wanna make it so it works on every big OS, but I just can´t find a way. Is there some kind of implemented way to do that or is there any tutorial on youtube or github? The thing is I wanna have a File Searcher where only specific Files are only listed if they have a specific extension.
15 Replies
there is https://docs.avaloniaui.net/docs/basics/user-interface/file-dialogs, i don't know exactly how it works on linux
But this works just like the one from windows forms right?
It works like how folder and file pickers/savers work in general. It calls the native loader/saver
ok, but is there a very simple way to make that like much simplier than that
I don't see how this is not already incredibly simple
The only thing required is getting the top level so you have the storage provider
I don´t understand the code nor how it works
i went from windows Forms to Avalonia, I understand xaml but I don´t understand how this works
Unlike Winforms, Avalonia is cross platform. You sometimes need some extra steps here to get things working
i know
In this case you need a top level, which is the root of your application
Other than that I don't think it's much different to Windows
so I need the Folderpath of my Application?
that can´t be
is it`?
That has nothing to do with it, I'm not sure what you are talking about
oh, ok I misunderstood something
ngl
https://github.com/AvaloniaUI/Avalonia/discussions/13599#discussioncomment-7562209 This is a very simple way to get the top level. Just define it in your app as a static variable depending on lifetime
GitHub
I am trying to get my toplevel for file dialog · AvaloniaUI Avaloni...
I am running var topLevel = TopLevel.GetTopLevel(this); in my mainviewmodel in order to open a save file dialog. However, I get this error: CS1503 Argument 1: cannot convert from 'xxxxxxxxxx.Vi...
It could be the Window or another visual depending on what the type of your application is, so therefore it's not explicitly defined
I personally don't know if this could be any easier, but I know there are people in #gui with very good experience in this. You could possible ask them
ok I will
Well i think we can close it I found my own solution for it 🙂