Hi guys, recently I started trying to make wpf application in VsCode and bonk, classic problem named ,,How tf I am supposed to do this?”.
I searched through Microsoft documentation and it’s not clear what exactly are methods or tools I can use to make the window content as I want. From where did you guys (ofc If you made this type of apk) learned what to do? (File type .xaml.cs are especially confusing) I would appreciate any help
Working with WPF from VS Code is somewhat difficult. While it’s a great code editor, it doesn’t have visual editing capabilities. Things will probably be a little easier if you can use the Community edition of Visual Studio instead.
The .xaml
files use XAML, an XML-like markup language to define your UI. These are the files that define how your Window will look. Each one generally has a .xaml.cs
file called “the code-behind”. This file is linked to the XAML and can handle events or manipulate elements within it. However, WPF developers do not like that approach and tend to use a pattern called MVVM instead. For the first little while, don’t worry about MVVM. It’s hard to learn 2 things at once.
I recommend getting a book, I don’t know of any good video series on WPF but someone might be able to clue me in. I liked Adam Nathan’s WPF Unleashed. It’s old, but not an awful lot has changed in WPF. For learning MVVM, you’ll have to lean on blogs, as far as I know few books cover it with any depth.
Thanks!
Are you familiar with the term ViewModel? WPF relies very heavily on that concept. Essentially, you have a custom class that is your viewmodel. Your custom class should, at the very least, implement the INotifyPropertyChanged interface. Then, you will raise the PropertyChangedEvent for the properties of your viewmodel that you have databound to your XAML (Form/Window/Page) when you want those properties to be updated in the view. It’s a rather intricate topic if you’re not fundamentally sound on the viewmodel concept. I’d be happy to try and explain it to you in Discord or something if you still need help.
Add me on dsc a_taki_se_polaczek#7369 Amd yes, I don’t know what is ViewModel or iproperty Thank you very much
I’m currently creating my first ever desktop app and decided to go with WPF myself. It’s been a surprisingly simple process so far, all thanks to Visual Studio 2019 Community Edition.
There’s a guy on YT that has tons of useful tutorials, too. Tim something…
C# devs
null reference exceptions