One collection – many views

Let’s imagine we have a huge collection of some objects (may be our data objects) and we need to filter this collection and display only a part of its elements in different places in our WPF application. Instead of creating many different instances of sub collection we can use the benefits of collection views. CollectionView is a wrapper around a collection that allows filterin…

By Mirek on (tags: CollectionView, WPF, categories: code)

knockout cart

I recently had an opportunity to put some new knockout knowledge into use.  Tekpub has a very nice training video on the subject, which was a great starting point, so let me show you the result. First some quick requirements: Every product has a button that adds a fixed number of items (in my case 1) to the cart There is a separate cart page The cart has a possibility to c…

By on (tags: javascript, knockout, categories: code, web)

TabControl and selected tab index

It was obvious for me that a TabControl in WPF, which is a container for TabItems, has a dependency property indicating the index of current tab. I was, also obviously, not surprised when I found TabIndex property on the TabControl. So without unnecessary thinking and spending time on that, I have set a binding to this property in my application. I was hoping that by changing b…

By Mirek on (tags: TabControl, WPF, categories: code)

Plugins in WPF MvvM with MEF

In this post I will show you the way we can implement a plugin functionality in WPF MvvM application with use of Managed Extensibility Framework (MEF). MEF is a tool that may facilitates extending and decoupling your application. In some scenarios it is very similar to Dependency Injection, but is rather focused on one primary purpose: Import and Export of objects. What is good…

By Mirek on (tags: MEF, mvvm, Plugins, WPF, categories: architecture, code)

Cross-property validation in WPF MvvM

In a previous post I have described hot to utilize a INotifyDataErrorInfo interface. Today I will show you my solution for automated cross-property validation integrated with the ModelValidation base class from previous post. First I add a custom CrossValidationAttribute and later on a virtual method which will be called from above CrossValidationAttribute for each property mar…

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

Utilizing INotifyDataErrorInfo in WPF MvvM app

Today I will show you how I utilize the INotifyDataErrorInfo interface to accomplish validation mechanisms in WPF application.   A time ago I have described how to validate model in WPF application with use of IDataErrorInfo interface. Now in WPF 4.5 we have another possibility which is the INotifyDataErrorInfo interface. The MSDN documentation is here a little scarce, but…

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

Dynamic fuzzy search with LINQ and entity framework and jQuery autocomplete part 4

Search has always been my most desired feature in applications and if I were to guess, I’m not the only one with this craving. The comfort and flexibility it gives you is enormous under one condition – it’s smart enough. Time for part four In part three we were left with two problems to solve in the method that fetches data for the search index. The code would select all column…

By on (tags: fuzzy search, categories: code)

Dynamic fuzzy search with LINQ and entity framework and jQuery autocomplete part 3

Search has always been my most desired feature in applications and if I were to guess, I’m not the only one with this craving. The comfort and flexibility it gives you is enormous under one condition – it’s smart enough. Part three is up We finished up the second part with ways to pull all the required information to run a db query. In the not-desired-concatenate-sql-statement …

By on (tags: fuzzy search, categories: code)

Dynamic fuzzy search with LINQ and entity framework and jQuery autocomplete part 2

Search has always been my most desired feature in applications and if I were to guess, I’m not the only one with this craving. The comfort and flexibility it gives you is enormous under one condition – it’s smart enough. It’s time for part 2 In the first part I gave an introduction on why I wanted to implement a custom search. Now, I’m going to show you how I did that. As a sta…

By on (tags: fuzzy search, categories: code)

Dynamic fuzzy search with LINQ and entity framework and jQuery autocomplete part 1

Search has always been my most desired feature in applications and if I were to guess, I’m not the only one with this craving. The comfort and flexibility it gives you is enormous under one condition – it’s smart enough. Let’s dig a little bit into the subject. Google has a well known feature that tries to suggest a different phrase if the one you entered is ‘a bit off’ (a.k.a …

By on (tags: fuzzy search, categories: code)