Skip to main content

WPF – ShowDialog on top of the Main Window

hidden

Hi devz, While using a Microsoft.Win32 Dialog (OpenDialog or SaveDialog), it is possible that it will be opened behind the Main Window. So a good way to go back on that dialog is to use the ALT+TAB combo. But not really intuitive for the end user. The best way would be that this dialog is […]

WPF – OpenFileDialog

openfiledialog

This is a simple example to have an OpenFileDialog (a premade view done by Windows to select a file to open) with WPF, filtering on XLSX file: In this case the InitialDirectory will always exist because it is the Desktop of the current user. But you have to know that if the targeted InitialDirectory doesn’t […]

WPF – ContentControl and TemplateSelector

Content_selection

Here is a simple example about the ContentControl and the TemplateSelector. This is really useful when you have a single model that can be represented on the UI in different ways depending on an enum for example. This will be the final result in the UI while using the same model: Let’s start with our […]

WPF – ProgressBar

WPF - ProgressBar

In this simple example, we will see how to create and manipulate the ProgressBar control from WPF in a MVVM way. Let’s start with the View in XAML: And now the ViewModel: Happy coding! 🙂

WPF – Enum Binding With Description in a ComboBox

Enum Binding with Description in a ComboBox - WPF MVVM

Hello Devz, In my two previous posts, I was talking about how to bind an enum (the classic way and the other way). But these have two major issues. First, all the items from the Enum will be bound and displayed. And sometimes you don’t want to display all of them (like ‘None’). Secondly, you […]