Monthly Archives: October 2015

List colors in WPF and C#

This example shows how to list colors and display color samples in a WPF ListBox. To build the list, the example demonstrates reflection, LINQ, and XAML data templates. The program uses the following XAML code to define the ListBox that … Continue reading

Posted in drawing, enums, graphics, LINQ, reflection, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Bind arrays and lists in C#

One way to display the items in an array in a ListBox is to loop through the items and add them to the ListBox one at a time, but there’s an easier way. You can bind arrays to a ListBox … Continue reading

Posted in arrays, controls, lists | Tagged , , , , , , , , , , , , | 2 Comments

Set video position with a scroll bar with WPF in C#

The example Control a video with the WPF MediaElement in C# lets you set video position in several ways. You can use the Next or Previous buttons to adjust the video’s current position by 10 seconds. You can also enter … Continue reading

Posted in controls, graphics, multimedia, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , , | Leave a comment

Make a XAML button library in C#

This example shows how you can build an easily reusable XAML button library in WPF. The example Make a WPF button template in C# uses a WPF button template to make nice round buttons that change their appearance appropriately when … Continue reading

Posted in controls, graphics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Make a WPF button template in C#

The example Control a video with the WPF MediaElement in C# uses attractive button images, but those images still sit on top of rectangular buttons. The images were generated by the example Make video control buttons in WPF and C#. … Continue reading

Posted in controls, graphics, multimedia, wpf | Tagged , , , , , , , , , , , , , , , , , , , , | Leave a comment

Control a video with the WPF MediaElement in C#

This example shows how you can control an MP4 video with WPF’s MediaElement control. The control provides a surprisingly nice assortment of features that let you play, pause, position, and otherwise control a video. The following XAML code defines the … Continue reading

Posted in controls, graphics, multimedia, wpf | Tagged , , , , , , , , , , , , , , , , , , | 2 Comments

Make video control buttons in WPF and C#

I recently wanted some images for video control buttons: play, pause, stop, fast forward, and so forth. I googled around and found lots of nice buttons, but all of the sets I found were missing one or more of the … Continue reading

Posted in drawing, graphics, wpf | Tagged , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Save WPF control images in C#

Occasionally I need to save WPF control images with transparent backgrounds for one reason or another. This time I needed to make some icons that displayed numbers. I could have used a Windows Forms application (it would have been a … Continue reading

Posted in drawing, files, graphics, wpf, XAML | Tagged , , , , , , , , , , , , | 1 Comment

Print at full scale in C#

This example shows how you can print at full scale so objects drawn on the screen are the same size when printed. Note that your screen and printer are probably not calibrated exactly so the result will not match perfectly. … Continue reading

Posted in drawing, GDI+, graphics, printing | Tagged , , , , , , , , , , , , , , , , | 2 Comments

Allow limited CheckBox selection in C#

Normally the user can check or uncheck any CheckBox independently of any other selections. This post shows how you can allow limited CheckBox selection. In this example the user can select up to 2 of the CheckBoxes. Whenever the user … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , | Leave a comment