1. What is Caliburn?
Caliburn is an open source framework of MVVM class proposed by Rob Eisenberg on January 26, 2009 (Rob’s mix10 talk “build your own MVVM framework”). It is a set of libraries used to assist in the development of WPF, Silverlight, WP7 and win RT applications.
Caliburn.Micro Officially released by Rob Eisenberg on June 7, 2010.
Caliburn.Micro Is a small and powerful framework designed to build applications on all XAML platforms. With strong support for MVVM and other proven UI patterns, Caliburn.Micro Will enable you to build solutions quickly without sacrificing code quality and testability
2. Project creation:
Step 1: create a project and install it for the current project using nuget package management tool Caliburn.Micro
Step 2: Project Creation:
newly build StartView.xaml
Delete the MainWindow.xaml
Modification App.xaml Delete startupuri=“ MainWindow.xmal “。
<Window x:Class="WpfApp8.StartView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp8"
mc:Ignorable="d"
Title="StartView" Height="450" Width="800">
<Grid Background="Gray">
<Button x:Name="testBtn" Content="testBtn" HorizontalAlignment="Center" VerticalAlignment="Center" Width="100" Height=" 50" Background="LightCyan"/>
</Grid>
</Window>
newly build StartViewModel.cs
using Caliburn.Micro;
using System.Windows;
namespace WpfApp8
{
class StartViewModel : Screen
{
public StartViewModel()
{
}
public void testBtn()
{
MessageBox.Show("hello world!");
}
}
}
Create a new class that inherits bootstrapperbase. Here I name it mybootstrapper
class
using Caliburn.Micro;
using System.Windows;
namespace WpfApp8
{
class MyBootstrapper : BootstrapperBase
{
public MyBootstrapper()
{
Initialize();//Initializing the framework
}
protected override void OnStartup(object sender, StartupEventArgs e)
{
DisplayRootViewFor<StartViewModel>();//show the main
}
}
}
Running results:
0
Read More:
- WPF: How to Reference Font Resource File
- How to fix the ERROR: Failed to build gem native extension in Centos 8
- C#: How to Use Itextsharp to Manipulate PDF Files
- [Solved] Pointsift Error: – ltensorflow not found_framework
- How to Solve C++ Error: “no matching function for call to ‘atoi/atof’”
- C#: How to get the value or text value of the select drop-down list
- [Solved] Centos7 Error: gcc: configure: error: in build‘: configure: error: no acceptable C compiler found in $PATH
- [Solved] Linux C++ warning: ISO C++ forbids converting a string constant to ‘char*‘ [-Wwrite-strings]
- [Solved] Ubuntu Eclipse C/C++ Error: launch failed.binary not found
- Sublime text 3 compiles and executes C/C++ programs directly
- [Solved] Ubuntu Compile Rust Program Error: failed to run custom build command for openssl-sys v0.9.39
- MAC: Clion configure C compiler Error: The C compiler identification is unknown
- NXP mx8 Platform tensorflow-lite build error [How to Solve]
- C# implementation of TXT document to table example code
- [Solved] Virtual Machine Error: FAILURE: Build failed with an exception.Flutter
- Android: How to Start App Automatically
- [Solved] Jenkins build error: esbuild install failed
- Solved: could not find the task ‘G + + build active file, leetcode algorithm ACM compilation and debugging
- [Solved] Execute ./configure Error: [error]configure: error: You need a C++ compiler for C++ support.
- Kylin arm64 linux configure: error: cannot guess build type; you must specify one