Category Archives: C#

WPF Double to Fraction Converter

While on a project creating a WPF application for some real heavy Excel users, I’ve received a lot of requests to make it more like Excel.  One of the requirements that came in was to allow the users to type … Continue reading

Posted in C#, WPF | Tagged , , | Leave a comment

Filtering Items in a WPF ComboBox

I was building a WPF application for a client which had a few ComboBoxes with large amounts of items as options in them.  The client asked for the users to have the ability to filter the items in the drop … Continue reading

Posted in C#, WPF, XAML | 6 Comments

WPF Textbox Select All on Focus

In WPF, the default behavior of the TextBox on focus is to put the cursor where it was the last time the TextBox had lost focus or if it hasn’t had focus yet, at the beginning. The users of the application wanted this to be changed so that when the TextBox got focus, all current text was selected. I found various ways to do this, but am putting this blog post together to get everything I ended up doing all in one place for easy access. Continue reading

Posted in C#, WPF | Tagged | 8 Comments

WPF MarkupExtension Class

This week I was going through StackOverflow, looking for anything I could help with and cam across someone asking about how to bind to an attribute of a class member in XAML.  I wrote a small example IValueConverter class they … Continue reading

Posted in C#, WPF, XAML | Tagged | Leave a comment

Choosing foreground using Luminosity Contrast Ratio

When a background is chosen by the user, you can use a converter that calculates luminosity contrast ratio for a black or white foreground to choose the best foreground color. Continue reading

Posted in C#, WPF | Tagged , | 5 Comments

WPF Date Range Double Slider Control (Part 3–Dependency Properties)

This is part 3 in a series I’m writing about a WPF User Control I’ve created and posted up on CodePlex.  In this installment, I’m going to be talking about creating dependency properties, in the DateRangeSlider, I used them to … Continue reading

Posted in C#, WPF | Tagged , | 3 Comments

WPF Date Range Double Slider Control (Part 2)

As I mentioned in my introduction to this series, I’m going over various aspects of how I implemented a control that allows a user to choose a DateTime range using a double slider control.  In Part One, I covered the … Continue reading

Posted in C#, WPF | Tagged , , | 2 Comments