Schlagwort: Styles

Created with Sketch.

Automatically grayed out Images in WPF – Version 2

This post describes a new, improved versions of the AutoGrayableImage introduced in this blog: https://www.engineeringsolutions.de/wp-admin/post.php?post=334 Why? There were some issues with the original version which made it hard to use in some scenarios. The new version will also include performance improvements and will enable us to use the same approach not only for images, but…
Weiterlesen

Creating ComboBox with System Colors in XAML

This snippet shows how to display a list of system colors in XAML only. First we create ab object data source containing the list of colors: <ObjectDataProvider ObjectInstance=“{x:Type Colors}“ MethodName=“GetProperties“ x:Key=“ListOfColors“ /> This data source obtains the list of colors from the properties of the Colors type. In the next step we define a data…
Weiterlesen

Automatically grayed out Images in WPF

There is a new blog post about this topic with a new improved version of the AutoGrayableImage: https://www.engineeringsolutions.de/wp-admin/post.php?post=663 The following class is a WPF image control which is directly derived from Image. Therefore it can be used out-of-the-box like the standard WPF Image control. The image will automatically change to a gray scale image when…
Weiterlesen

Showing a ComboBox with Different Line Types

This can be used to choose the line type from a ComboBox, for example in a drawing application. The first entry is a solid line, the second is a dashed line and the last entry displays a dotted line. <ComboBox Width=“80″ SelectedIndex=“0″> <ComboBoxItem Height=“23″> <Line X1=“0″ X2=“60″ Y1=“11″ Y2=“11″ Stroke=“Black“ StrokeThickness=“2″ /> </ComboBoxItem> <ComboBoxItem Height=“23″>…
Weiterlesen

Some CSS3 Effects

Shadows Draws a shadow of any HTML element. The first is the shadow distance on the Y axis, the second on the X axis. The third value stands for the blurring of the shadow edges. The last value is the shadow color. -webkit-box-shadow: 5px 5px 10px #000000; -moz-box-shadow: 5px 5px 10px #000000; box-shadow: 5px 5px…
Weiterlesen

Text Drop Shadow Effect in XAML

A DropShadowEffect can be used to make any WPF control cast a shadow. In order to use this on a text, we can simply assign the effect to the Effect property of the TextBlock. DropShadowEffect contains properties to set the shadow depth, the direction, color of the shadow, opacity and a blur radius. This gives…
Weiterlesen

Use Text Wrapping in a WPF DataGrid TextColumn

You can simply use styles to enable text wrapping in a WPF DataGrid Column. This sets the element style of the standard column control and of the column control that is used when the cell is in edit mode. <DataGridTextColumn> <DataGridTextColumn.ElementStyle> <Style TargetType=“TextBlock“> <Setter Property=“TextWrapping“ Value=“WrapWithOverflow“/> <Setter Property=“TextTrimming“ Value=“WordEllipsis“/> </Style> </DataGridTextColumn.ElementStyle> <DataGridTextColumn.EditingElementStyle> <Style TargetType=“TextBox“> <Setter…
Weiterlesen