Skip to main content

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 – MVVM DataTemplateSelector

Hello devz, Let’s say that you want to create your UI but in a dynamic way. Let me explain. Imagine a view which is based on a list of items you want to display. But this list can vary (depending on rights, or context).¬†In this simple example, we want a label with a textbox, then […]

WPF – Paste Clipboard content from Excel to a GridView

copy paste

Hello Devz, Manipulating the clipboard content is pretty easy. But it can become handy when pasting it in a GridView. Here a simple example on how to paste the content of the clipboard from Excel to a GridView. First things first! Here is how to use the clipboard:

Obviously you could use the SetText(string) method […]

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 […]

WPF – Enum Binding in a ComboBox – The Classic Way

Enum binding to combobox

Hello Devz, I had to write this post about how to do¬†an Enum binding¬†to a ComboBox, because everytime I need it, I’m surprised there is no “out-of-the-box” solution provided in WPF or Xamarin.Forms.

Please notice this line: xmlns:sys=”clr-namespace:System;assembly=mscorlib” And the ObjectDataProvider¬†in the Window.Resources. With a simple Enum called StatusEnum:

So this was the […]

WPF – PasswordBox Helper

passwordbox

Because security matters, you will need at one point to use a PasswordBox in your WPF application (you know, the textBox hiding the password with stars). But Microsoft didn’t make this control bindable for security reasons (in memory access). So if you’re using MVVM, it will be a bit tricky. Different solutions exist, but really […]