I don't like to use XAML. I prefer to code everything in C#, but I think that I am doing things wrong.
In which cases it is better to use XAML and when do you use C#? What is your experience?
XAML is a new descriptive programming language developed by Microsoft to write user interfaces for next-generation managed applications. XAML is the language to build user interfaces for Windows and Mobile applications that use Windows Presentation Foundation (WPF), UWP, and Xamarin Forms.
XAML is dead. No wait - Long live XAML. XAML (Extensible Application Markup Language) started life as a simple thin UI markup layer, but has had a surprisingly eventful history. Developers on Microsoft's technology stack have been witnesses to XAML's phenomenal rise as well as its teetering on the edge of life support.
xaml. cs is the code-behind page for MainPage. xaml. It's where you add your app logic and event handlers. Together these two files define a new class called MainPage , which inherits from Page, in the HelloWorld namespace.
In C++, you can build apps with C++/CX and XAML or DirectX, or a combination of both. In addition, you can create an application that's a hybrid of these technologies, such as writing a component in C++/CX that's then used from a Windows Store app built with JavaScript/HTML.
Creating an entire window in C# can be a mess of code. The best thing about WPF is that XAML allows you to separate your design from your logic, making for much easier-to-read code.
I'll use C# when I need to create dynamic controls, but I tend to keep my general design, static storyboards, styles, datatemplates, etc. in XAML.
Check out this video on MVVM in WPF. If you want wrap your head around how to organize a WPF application vis-a-vis what goes in XAML, code behind and other abstractions, this is a great place to start.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With