Microsoft.NET Trainingen

Reflection IT heeft een passie voor kennis delen en heeft zich ontwikkeld tot hét opleidingscentrum voor Microsoft Software Development trainingen.

Bekijk trainingen

Blog Artikelen

Implement IXmlSerializable in a readonly struct

14-Jun-2022

Xml serialization is really common. For a class this is done automatically, but not for your own struct. The primitive structs from Microsoft (bool, byte, short, int, long, double, decimal, etc.) don’t have this problem. The serialization and deserialization of those types are done by the XmlSerializer class. For your own struct you have to implement the IXmlSerializable interface. This isn’t really hard, but it is harder when the struct is a readonly struct. A feature which Microsoft added to C# 7.2 a few years ago. The problem is caused by the ReadXml() method of this interface. This method returns a void which means that you have to modify the fields inside the struct, which is not allowed if the struct is readonly. Luckily there is a solution using the Unsafe.AsRef() method. In this blog I will explain how to use it.

Accelerator keys for ContentDialog Buttons

25-Feb-2022

Accelerator keys (or keyboard accelerators) are keyboard shortcuts that improve the usability and accessibility of your Windows applications by providing an intuitive way for users to invoke common actions or commands without navigating the app UI. You can add them to a Button using the KeyboardAccelerators property. See the example below.

XAML inline RowDefinitions and ColumnDefinitions

01-Dec-2021

In the XAML of WinUI3 apps you can use the inline syntax for creating Rows and Columns inside a Grid. This is a feature which Avalonia had for a long time. It is more compact and works fine as long as you don't need a Max or Min Width/Height.

The following screenshot shows you a Grid with 2 Rows and Columns. Both in equal size. Using 4 Rectangle elements I created the Microsoft logo inside this Grid.

WinUI XAML with normal Row and Column Definitions

The following screenshot shows you the same Grid but now with inline RowDefinitions and ColumnDefinitions. It saves you a few lines of XAML.

WinUI XAML with inline Row and Column Definitions

Reflection IT

Bij Reflection IT hebben we een passie voor kennis delen en zijn we hét opleidingscentrum voor Microsoft Software Development trainingen.

We ontwikkelen ook apps, omdat het leuk is en leerzaam. In deze apps kunnen we nieuwe Microsoft producten en technologieën toepassen, deze ervaring gebruiken we dan weer in onze trainingen.

Maak kennis met oprichter Fons Sonnemans en ons team van ervaren docenten, die ook allemaal developers zijn.

Fons Sonnemans

Proud of our customers

  • Actemium
  • ASML
  • Besi
  • Maastricht University
  • Microsoft
  • Promexx
  • Sioux
  • Topic
  • Topicus

Get in touch

Met dit formulier kunt u informatie over een In-Company of Small-Group training aanvragen. U kunt in het bericht aangeven welke training u wilt, voor hoeveel personen, wanneer deze verzorgd moet worden en op welke locatie. Wij nemen vervolgens contact met u op.

U kunt ons ook bereiken via telefoonnummer +31 (0)493-688810 of per mail training@reflectionit.nl.