Hey,
I've noticed that some of you are interested in WPF, so I want to tell you a little bit about this awesome technology. I'm creating applications using the WPF for 2 years and I earned lots of experience.
What is WPF?
WPF (Windows Presentation Foundation) is a technology from Microsoft to create a User Interface. WinForms and Console are the other ones provided by Microsoft. It's important to note that WPF doesn't replace WinForms and WinForms doesn't replace Console. All of them have something they are the best at.
With WPF, you don't drag and drop controls from the toolbox - you could do that, but it's cruel and destroys the awesomeness of WPF: Please don't do that. In WPF, you create the view using a special language: XAML (Extensible Application Markup Language)!
You can use WPF with C# or VB.Net - it doesn't depend on a programming language.
XAML
As some of you already now, XAML is the language to create something you can see in WPF. XAML is a markup language, which means that it looks similar to HTML (Hypertext Markup Language) and XML (Extensible Markup Language). XAML is pretty easy to understand and if you know a little bit about HTML, you don't need much time.
Here is a small sample. It will create a black banner which is 30 units high and contains a white text "Hello World" (centered). Below, there is a centered button with the text "Just a random button".
Layout
In WPF, you don't say this button is 25 pixels high. You say that it's 25 units high. This is relative to the screen resolution. With WinForms, a button with 25 pixels will be very, very small on a 4k monitor. In WPF, it will be the same height as on a hd screen.
Also, you don't set an absolute location for the controls. You don't say the button is on (X=100,Y=100) - the button doesn't even have the properties. The layouts are dynamic and you can scale them as you want - there won't be any whitespace if done right.
MVVM
I think that it's almost impossible to be a WPF programmer and never hear about something called MVVM (Model View ViewModel), but what is that? In WinForms, you drop a button on the form and make a double click on it to subscribe to the click-event. In MVVM, you don't use eventhandlers to react to an event. You bind properties to a class called ViewModel. Okay, you may understand nothing, if you want to learn that, just google it. MVVM is pretty hard to understand, but if you understood the concept, it's awesome^2. It is clean, allows you to create laaaarge windows and makes unit testing really easy. Really, you won't want to code using events ever again. It is worth every second you invest in learning that, trust me ;)
Styles
In WPF, a control doesn't have a look. A control is just a behavior. The look comes with the style you set on it. If you change the default styles in the file App.xaml, all controls in your whole application will look different. That's just awesome for styling your application, unlike WinForms you don't have to change every control.
Animations/Storyboards
WPF supports animations. It is pretty easy to animate almost every property of a control like width, height, opacity, RenderTransform (rotation), ... You can set the duration and the start time for the animation. Also, you can animate colors which is just awesome!
WPF renders with Direct X, it has a great performance.
Okay, if you want to learn WPF now, just google a little bit, you'll find lots of posts which recommend resources for learning this awesome technology (look for StackOverflow posts). If you are new to programming, I wouldn't recommend to start with WPF because it is a little bit more complicated than WinForms or Console.
If you have any questions about WPF, feel free to ask me :)
I've noticed that some of you are interested in WPF, so I want to tell you a little bit about this awesome technology. I'm creating applications using the WPF for 2 years and I earned lots of experience.
What is WPF?
WPF (Windows Presentation Foundation) is a technology from Microsoft to create a User Interface. WinForms and Console are the other ones provided by Microsoft. It's important to note that WPF doesn't replace WinForms and WinForms doesn't replace Console. All of them have something they are the best at.
With WPF, you don't drag and drop controls from the toolbox - you could do that, but it's cruel and destroys the awesomeness of WPF: Please don't do that. In WPF, you create the view using a special language: XAML (Extensible Application Markup Language)!
You can use WPF with C# or VB.Net - it doesn't depend on a programming language.
XAML
As some of you already now, XAML is the language to create something you can see in WPF. XAML is a markup language, which means that it looks similar to HTML (Hypertext Markup Language) and XML (Extensible Markup Language). XAML is pretty easy to understand and if you know a little bit about HTML, you don't need much time.
Here is a small sample. It will create a black banner which is 30 units high and contains a white text "Hello World" (centered). Below, there is a centered button with the text "Just a random button".
Code
<Window [...]>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Background="Black">
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="White"
Text="Hello World" />
</Grid>
<Button Grid.Row="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="Just a random button" />
</Grid>
</Window>Layout
In WPF, you don't say this button is 25 pixels high. You say that it's 25 units high. This is relative to the screen resolution. With WinForms, a button with 25 pixels will be very, very small on a 4k monitor. In WPF, it will be the same height as on a hd screen.
Also, you don't set an absolute location for the controls. You don't say the button is on (X=100,Y=100) - the button doesn't even have the properties. The layouts are dynamic and you can scale them as you want - there won't be any whitespace if done right.
MVVM
I think that it's almost impossible to be a WPF programmer and never hear about something called MVVM (Model View ViewModel), but what is that? In WinForms, you drop a button on the form and make a double click on it to subscribe to the click-event. In MVVM, you don't use eventhandlers to react to an event. You bind properties to a class called ViewModel. Okay, you may understand nothing, if you want to learn that, just google it. MVVM is pretty hard to understand, but if you understood the concept, it's awesome^2. It is clean, allows you to create laaaarge windows and makes unit testing really easy. Really, you won't want to code using events ever again. It is worth every second you invest in learning that, trust me ;)
Styles
In WPF, a control doesn't have a look. A control is just a behavior. The look comes with the style you set on it. If you change the default styles in the file App.xaml, all controls in your whole application will look different. That's just awesome for styling your application, unlike WinForms you don't have to change every control.
Animations/Storyboards
WPF supports animations. It is pretty easy to animate almost every property of a control like width, height, opacity, RenderTransform (rotation), ... You can set the duration and the start time for the animation. Also, you can animate colors which is just awesome!
WPF renders with Direct X, it has a great performance.
Okay, if you want to learn WPF now, just google a little bit, you'll find lots of posts which recommend resources for learning this awesome technology (look for StackOverflow posts). If you are new to programming, I wouldn't recommend to start with WPF because it is a little bit more complicated than WinForms or Console.
If you have any questions about WPF, feel free to ask me :)


![[Image: signature.png]](https://raw.githubusercontent.com/CodeElements/CodeElements.Suite/master/signature.png)

![[Image: iDfqHPM.png]](https://i.imgur.com/iDfqHPM.png)

![[Image: signaturetwo.png]](https://u.cubeupload.com/Vyxn/signaturetwo.png)