Category Archives: .net

Maximizing code reuse using Xamarin and Cordova

This post was inspired by my recent adventures into getting Cordova to run on MonoDroid. The first post will introduce Xamarin and Cordova and provide some motivation around why this approach may make sense. I will also outline a high level approach on how we can integrate the two products. In my next post, I [...]

Dynamic .Net Licensing

.Net application licensing is an interesting topic. Many third party components have a run-time licensing model based on compiled license files. The idea is that you build your application executable and embed a compiled licenses resource into the assembly. During runtime, the third party components retrieve the executable assembly using Assembly.GetEntryAssembly() and attempt to open [...]

WPF UIElement caching in the ContentControl

In a previous post I outlined an approach to abstract away the creation of a View for a ViewModel. I find this approach very elegant and we have successfully used it on a project. However, you can run into an issue with it because of how WPF’s ContentControl caches View instances. Let’s assume that we [...]

Creating ViewModel to View mappings

One of my favorite approaches to creating View/ViewModel pairs in WPF it to use data templates. Say you have a ViewModel called MyViewModel and it should be displayed in the UI as the View MyView. We can create a fairly straightforward DataTemplate defined as: <DataTemplate DataType=”{x:Type local:MyViewModel}”> <local:MyView /> </DataTemplate> Whenever we add the ViewModel [...]

WPFying DataRow

Our team encountered a strange issue recently. We have a strongly typed DataSet. We observed inconsistent behavior when binding our UI to DataRow objects or the DataRowView for those rows. In particular, WPF did not appear to refresh all the bindings when the DataRow’s column values changed. We also observed that property change notification on [...]

WPF Dispatcher Frames

A few months ago, I read into some advanced WPF threading topics. One that had been particularly confusing to me is the idea of a DispatcherFrame. I hope that this article can shed some light on what it is, how they can be used and why we should care. Message Loops Win32 applications revolve around [...]

Controlling UI using power shell (part 1)

Ever since PowerShell was released, I’ve been very interested in the technology. Coming from a linux background, I love the command line. And, let’s face it, cmd is shameful. I have been imagining a UI environment in which at any point, anyone can enter into a command line and have access to all of the [...]

A WPF Splash Screen

When I was first looking into displaying a splash screen in a WPF app, I found a large number of examples using some managed code. I then found some samples using .Net 3.5 Sp1′s WPF Splash Screen implementation. None of these really suited my requirements. We weren’t looking for only displaying an image. We were [...]

Referencing generic types in XAML

This post is an elaboration of my answer on StackOverflow to a question about referencing a generic type in XAML. The first responder had a good idea on how to approach the problem. It did not solve the question for the author, so I went ahead and elaborated on his approach and created a generic [...]

Custom Resolver

In my previous post, I explained a problem that we have encountered with .Net, WPF and custom Assembly redirection. In this post, I will explain how to build a custom resolver class that can attach to an AppDomain and redirect the assembly requests to whatever assembly you would like it to. Recall that if the [...]