Last year I wrote Bootstrapping Caliburn.Micro with Autofac and it has since become one of my most popular posts. While the code presented in the post worked at that time, wizbit and Craigology pointed out that it stopped working with newer versions of Autofac. I set out to do the minimum amount of changes to make it work with the newest versions Autofac and Caliburn.Micro.
The Best Laid Plans That was the plan.
Over the last few weeks I have been writing some in-depth articles for my Learning Caliburn.Micro series. Today is a brief side-discussion where I introduce a ReSharper File Template to help with the task of generating view-models.
Background So why do you need this template? Simple – to write those twenty or so lines of code you constantly have to do yourself. I will warn you – this template is highly opinionated.
It has been about two weeks since my last post in my Learning Caliburn.Micro series, so it far past the time for this post.
Prepare the Project This post is going to focus on using the Autofac IoC with Caliburn.Micro. From the point of view of the framework it fulfills the same task as the MEF bootstrapper I discussed in Caliburn.Micro the MEFtacluar, or Rob discussed in Caliburn.Micro Soup to Nuts Pt.
Caliburn.Micro Logging Abstraction This post covers logging. Caliburn.Micro has a simple logging abstraction that consists of an ILog interface, and a LogManager class (see below).
To add logging to any Caliburn.Micro project, you need to implement a class that extends the ILog interface, and you need to replace the delegate for GetLog. In this post, I will show you how to hook up a debug logger that logs to the Output window in Visual Studio, a log4net logger, and an NLog logger.
I was going to call this post ‘How I learned to stop worrying and love MEF.‘, but I am not sure enough people would get the reference. Besides, it would put the focus too much on MEF, and not on Caliburn.Micro, which is the topic of the post.
This is the second in my series of using Caliburn.Micro for WPF applications. The first post, Caliburn.Micro – Hello World, covered an introduction to setting up a project, and the basics of view and view-model interaction.
In this post we are going to create a simple WPF application using Caliburn.Micro.
I have created an empty Visual Studio 2010 solution for all the projects in this blog series. All of the code for this series will be available on my Github Learning Caliburn.Micro repository. But I suggest you follow along, and try and do it yourself.
Start Visual Studio, and create a new WPF Application project called HelloWorld.
I have used a number of different MVVM frameworks, and none has so-far felt right. Not the worlds most scientific criteria, I will grant you, but still one that I consider valid. I have a preference for lighter-weight frameworks. Another vague criteria, but my definition of it is simple – frameworks that do not impose rigid structures and significant bloat to my application by adding features I dont need. Some of the frameworks I have worked with are: Cinch, MEFedMVVM, MVVM Light Toolkit, and Caliburn.
In my efforts to experiment with WPF, I decided to try the always popular WPF sample of an irregular or custom shaped window. I had set out the following goals for this sample:
Create an oval shaped window with no standard Windows chrome Create a context menu that supports minimizing and closing the window Support dragging the window when the left mouse button is pressed Step 1 - Create an oval shaped window with no standard Windows chrome Searched the web yields a significant amount of results on how to do this, so I am only going to summarize the solution.
For the past few years Microsoft has been pushing WPF as the future user interface framework for .NET. During that time I have seen numerous demos and presentations showing amazing user interfaces. They would describe the new model of separating the designer from the developer, and how successful they were. I would usually ask two questions as a response. First, how many designers and developers were involved. Second, how close to the original time and resource estimate was the actual effort.
I always have a tough time remembering the proper syntax for the XAML data binding. Maybe I am getting old, or I just can’t deal with yet another syntax to remember, or worse – I have become too dependant on IntelliSense. No matter what the cause, I was really grateful that Nbd-Tech put together a useful cheat sheet for the WPF Data Binding.
Here is a small snippet of the three page document.