private static void onWindowIconCharChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { EntityBoundWindow wind = (EntityBoundWindow)d; if (e.NewValue == null || !(e.NewValue is char c)) { return; } var bmp = DrawingHelper.CreateBitmapSource(DrawingHelper.DrawTextToFixedBitmap(c.ToString())); wind.Icon = BitmapFrame.Create(bmp); }