Category Archives: XAML

Draw a smiley face with WPF in C#

Often I need to use images for demonstration purposes or for a book, and a smiley face makes a neutral, pleasant image. This example shows how to draw a smiley face with XAML and WPF, and then save an image … Continue reading

Posted in drawing, graphics, image processing, wpf, XAML | Tagged , , , , , , , , , , , , , , | Leave a comment

Use WPF code to display subscripts and superscripts in C#

In the post Display subscripts and superscripts in a WPF TextBlock in C# I mentioned that you could make subscripts and superscripts in WPF code but it was easier in XAML code. Juan Manuel Montes asked for an example, so … Continue reading

Posted in fonts, formatting, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , | Leave a comment

Display subscripts and superscripts in a WPF TextBlock in C#

The following examples show how to display subscripts and superscripts in a RichTextBox in a Windows Forms program. Easily display subscripts and superscripts in a RichTextBox in C# Display subscripts and superscripts in a RichTextBox in C# In a WPF … Continue reading

Posted in fonts, formatting, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , | 1 Comment

Draw smoother cones using WPF and C#

The example Draw smooth cones using WPF and C# shows how to draw some fairly smooth cones in WPF and C#. This example shows how to make even smoother cones. In the picture on the right, the cone on the … Continue reading

Posted in algorithms, drawing, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , , | Leave a comment

Draw smooth cones using WPF and C#

The example Draw cones using WPF and C# shows how to draw cones in WPF and C#. This example shows how to draw smooth cones. Or at least smoother cones. To make smooth cones, the program simply ensures that adjacent … Continue reading

Posted in algorithms, drawing, geometry, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , | 1 Comment

Draw cones using WPF and C#

This example shows how to draw cones in WPF and C#. The program uses a method very similar to the one used by the example Draw cylinders using WPF and C#. The picture on the right shows the approach used … Continue reading

Posted in algorithms, drawing, geometry, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 1 Comment

Find an image URI in a WPF program in C#

One of the more annoying changes introduced in WPF and XAML is the image URI. Now instead of simply selecting an file from a resource, you need to supply an arcane string such as: pack://application:,,,/howto_wpf_learn_uri;component/csharp_prog_ref.png It’s another case of WPF’s … Continue reading

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

Load a WPF TreeView control from an XML file in C#

The post Load a TreeView control from an XML file in C# explains how you can display XML data in a Windows Forms TreeView control. This example does something similar for a WPF project. In keeping with the unofficial WPF … Continue reading

Posted in controls, wpf, XAML, XML | Tagged , , , , , , , , , , , , | 3 Comments

Display a perspective image in C#

A while ago someone asked me how he could display an image in WPF with one side smaller than the other to produce a faux perspective look as shown in the picture on the right. Unfortunately two-dimensional WPF (and Windows … Continue reading

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

A quick note about the .NET Graphics book Kickstarter

Several people have told me, “I will definitely buy the book when it’s finished.” Unfortunately that’s not the way Kickstarter works. You need to sign up now to receive a copy of the book. If we reach the project goal, … Continue reading

Posted in algorithms, drawing, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , , , , | Leave a comment