Skip to content

Instantly share code, notes, and snippets.

@dbuksbaum
Created April 28, 2015 16:23
Show Gist options
  • Select an option

  • Save dbuksbaum/a4d5e9d5db251191df63 to your computer and use it in GitHub Desktop.

Select an option

Save dbuksbaum/a4d5e9d5db251191df63 to your computer and use it in GitHub Desktop.
Caliburn.Micro – Hello World
<Application x:Class="HelloWorld.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:HelloWorld">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<local:HelloWorldBootStrapper x:Key="bootstrapper" />
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Caliburn.Micro;
using HelloWorld.ViewModels;
namespace HelloWorld
{
public class HelloWorldBootStrapper : Bootstrapper<MainViewModel>
{
}
}
<UserControl x:Class="HelloWorld.Views.MainView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="500">
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Name: " />
<TextBox x:Name="Name" />
</StackPanel>
<TextBlock x:Name="HelloString"/>
<Button x:Name="SayHello" Content="Click Me"/>
</StackPanel>
</UserControl>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Caliburn.Micro;
namespace HelloWorld.ViewModels
{
public class MainViewModel : PropertyChangedBase
{
private string _name;
private string _helloString;
public string Name
{
get { return _name; }
set
{
_name = value;
NotifyOfPropertyChange(() => Name);
NotifyOfPropertyChange(() => CanSayHello);
}
}
public string HelloString
{
get { return _helloString; }
private set
{
_helloString = value;
NotifyOfPropertyChange(() => HelloString);
}
}
public bool CanSayHello
{
get { return !string.IsNullOrWhiteSpace(Name); }
}
public void SayHello(string name)
{
HelloString = string.Format("Hello {0}.", Name);
}
}
}
@mohamad-alibrahim

Copy link
Copy Markdown

you application does not works
Severity Code Description Project File Line Suppression State
Error The name "HelloWorldBootStrapper" does not exist in the namespace "clr-namespace:HelloWorld".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment