Quantcast
Channel: Caliburn.Micro: Xaml Made Easy
Viewing all articles
Browse latest Browse all 1760

Updated Wiki: Nuget

$
0
0

Nuget Package Installation

NuGet is a Visual Studio 2010 extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects that use the .NET Framework. Caliburn.Micro is proud to support the NuGet Package Manager.

Installing the Package

With the latest version of Nuget installed, open the Package Manager Console and type:

PM> Install-Package Caliburn.Micro.Start


After Installation

1. Clean out your App.xaml.cs file. It should look like this:


namespace YourNamespace
{
    using System.Windows;

    publicpartialclass App : Application
    {
        public App()
        {
            InitializeComponent();
        }
    }
}

2. Add the AppBoostrapper to your App.xaml's Resources section.

Silverlight

<Applicationxmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:local="clr-namespace:YourNamespace"x:Class="YourNamespace.App"><Application.Resources><local:AppBootstrapperx:Key="bootstrapper"/></Application.Resources></Application>
Note: You no longer need the default MainPage.xaml.

WPF

<Applicationxmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:local="clr-namespace:YourNamespace"x:Class="YourNamespace.App"><Application.Resources><ResourceDictionary><ResourceDictionary.MergedDictionaries><ResourceDictionary><local:AppBootstrapperx:Key="bootstrapper"/></ResourceDictionary></ResourceDictionary.MergedDictionaries></ResourceDictionary></Application.Resources></Application>
Note: Make sure to remove the StartupUri value. Caliburn.Micro will be handling the main window creation for you. As a result, you no longer need the MainWindow.xaml either.

Windows Phone 7

<Applicationxmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:local="clr-namespace:YourNamespace"x:Class="YourNamespace.App"><Application.Resources><local:AppBootstrapperx:Key="bootstrapper"/></Application.Resources></Application>

Note: If you move your MainPage.xaml into a Views folder, don't forget to update your WMAppManfiest.xml to point to the new URI, as follows:
<Tasks><DefaultTaskName="_default"NavigationPage="/Views/MainPage.xaml"/></Tasks>

WinRT

For WinRT, the process of getting started is unfortunately quite different from the other platforms, due to significant design differences in the Windows Xaml APIs. For detailed instructions please see Working with WinRT.

3. Run your application.

4. Review the Cheat Sheet.


Viewing all articles
Browse latest Browse all 1760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>