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: var clipboardContent = Clipboard.GetText(); Obviously you could use […]
WPF – MVVM TextBox Validation with IDataErrorInfo
Hello Devz, This post will describe how to do a simple MVVM TextBox validation with IDataErrorInfo. UI Data Validation is an important part of the FrontEnd creation. The FrontEnd should always be backed up by the BackEnd validation! But here we will focus only on the FE part. Before showing the code, you have to […]
WPF – Enum Binding With Description in a ComboBox
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 Other Way
Hello Devz, In a previous post I was talking about the fact that there is no “out-of-the-box” solution to bind an Enum to a ComboBox. And I described the WPF way of doing it with the ObjectDataProvider defined in the XAML. Here is another way, more code oriented than XAML. This is the XAML part: […]
WPF – Enum Binding in a ComboBox – The Classic Way
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. <Window x:Class=”EnumBinding.MainWindow” xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” xmlns:d=”http://schemas.microsoft.com/expression/blend/2008″ xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006″ xmlns:local=”clr-namespace:EnumBinding” xmlns:sys=”clr-namespace:System;assembly=mscorlib” mc:Ignorable=”d” Title=”MainWindow” Height=”350″ Width=”525″> <Window.Resources> <ObjectDataProvider x:Key=”dataFromEnum” MethodName=”GetValues” ObjectType=”{x:Type sys:Enum}”> <ObjectDataProvider.MethodParameters> <x:Type TypeName=”local:StatusEnum”/> </ObjectDataProvider.MethodParameters> […]
C# – Aspose.Cells – Create Excel files without Excel
Hello Devz, It is common to have to export data to an Excel file. But sometimes the code have to run on a server where Excel is not or can’t be installed. And anyway, to be honest the Excel Interop is a real piece of crap to use… So Aspose did a good work by […]
C# – SI prefixes for metric units – because size matters
Sometimes you will have to play with numbers, BIG numbers… Or teeny-tiny ones! To avoid having too many zeros you can use the SI prefixes (like metric units: mm, cm, m, km, …). Here are the results of our code: 123,460000 -> 123,460 w (1000) 123,460000 -> 123,460 w (1024) 1.234,560000 -> 1,235 kw (1000) 1.234,560000 […]
Google Dialogflow – create your own AI in a few clicks
Hello Devz, Having a Google Home at home and a Google Assistant in my pocket, I wanted to go further and create my own Actions. Pretty easy with Google DialogFlow! DialogFlow is a free web interface that allows you to create a, wait for it… dialog flow! Let’s say I want to add an expense […]
WPF – PasswordBox Helper
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 […]
MS SQL – Performance optimisation on the indexed primary key
Hello Devz, Today I had an issue with the performance of a SQL stored procedure. This procedure was supposed to delete a few millions rows in a table. But it was quite slow… So after optimizing the query, I looked at the database itself. Having an indexed primary key is important but the level of […]