Simple, bindable PieChart in WPF

Today I will show you a simple way to have a pie chart in your WPF application with use of ItemsControl. The pieces of the pie will be binded to the undergoing item model collection. Let’s take a look at it. The goal is to achieve a pie chart presented on the picture below, having just a collection of items.     Each item should be an object with following properties …

By Mirek on (tags: itemscontrol, Pie Chart, WPF, categories: code)

Semantic Versioning

We’ve been using semantic versioning for a while now and it’s been paying out. Though there were some ‘quirks’. Now, version 2.0 is (almost) out and guess what, it addresses them! Let’s take a look at the new version and see what changed. I’m going to start with a little propaganda. Why you SHOULD use semantic versioning or at least some sort of reasonably (though that’s subjec…

By on (tags: versioning, categories: architecture)

Private Deploy of EF with SQL CE 4.0 and Click Once

Recently I faced the problem with deploying an WPF application, which uses Entity Framework and Sql Server Compact 4.0 nuget packages. The application was deployed automatically by TFS Server as a Click Once  installer. The problem was that the setup did not download Sql Server package at client machine and application could not work. Apart from checking what is maybe wron…

By Mirek on (tags: Click Once, deployment, Entity Framework, Sql Ce, Sql Server Compact 4.0, categories: infrastructure)

Simple validation in WPF MvvM Part 2

In a previous post I showed you how to use IDataErrorInfo interface to implement simple validation mechanism in WPF MvvM application. In this post we will try to extend and customize this approach a little. It would be nice I the fields of the form be validated on Save button click. So the user will not see error messages when he opens the for for the first time To achieve that…

By Mirek on (tags: IDataErrorInfo, mvvm, validation, WPF, categories: code)

Simple validation in WPF MvvM using IDataErrorInfo

In this post I will try to demonstrate the simplest validation approach for Windows Presentation Foundation application designed in Model View View-Model pattern. We will be using data binding and IDataErrorInfo implementation. Ok. Let’s assume we have simple data model ProductModel which looks like this So we have Name, Price and Amount text boxes, which we want to bind to the…

By Mirek on (tags: IDataErrorInfo, mvvm, validation, WPF, categories: code)

Parametrized BooleanToVisibilityConverter

Windows Presentation Foundation allows us to create our own value converters and use them in XAML bindings. WPF also comes with a set of predefined converters. One of them is BooleanToVisibilityConverter. It this post I will show you how to create own version of this converter with parameter feature supported. BoleanToVisibilityConverter sets the Visibility value to Visible whe…

By Mirek on (tags: BooleanToVisibilityConverter, IValueConverter, WPF, categories: code)

Gradient generator for WPF

Have you ever straggled with generating and polishing gradient for wpf in xaml? I did many times. Did you use any tool for that, except Visual Studio Property tab? I didn’t. Until I stumble upon Online Gradient Maker. I thought the Visual Studio designer and editor is all you need to create rich WPF apps, until I had to create a style for radio button with circular gradient on …

By Mirek on (tags: gradient, WPF, XAML, categories: tools)

Because empty tags are bad

Well, not always, but there are times when they are so…what can I do to avoid them. Up to asp.net mvc 3 there’s a problem – if I want to render something wrapped in let’s say a paragraph, but I don’t want that paragraph to appear if the content is empty, then the markup looks like this: That’s a bit verbose. If I skip that check, then an empty hole is rendered on the page so ag…

By on (tags: mvc, categories: code)

Custom WPF check box with inner shadow effect.

Today I will show you how to override the CheckBox control template to style it in custom way and add a sexy looking shadow effect. We want to replace the standard windows checkbox look with something cooler and fit to our application design Windows Presentation Foundation controls are based on Styles and templates. When you want to change the look of the control you have to st…

By Mirek on (tags: CheckBox, inner shadow, styling, WPF, categories: code)

MVC custom validator with client side validation

I wanted to have a reusable email validator since there have been a few cases already where I needed one. Previously I just used the RegularExpressionAttribute but that’s verbose for email. So, without thinking much, I created an attribute that derived from RegularExpressionAttribute and supplied it with a regex I used – that turned out to be a surprise. The server side validat…

By on (tags: mvc, categories: code)