2017-03-20 9 views
2

私は古いCaliburn Microのチュートリアル(here)で作業しています。私はパート2までです(here)。私は、App.xamlとAppBootstrapper.csを3.0.3とWPF(ここでは 'Documentation'ページの 'WPF'セクションで概説)と互換性を持つように更新しました。私はVS 2013を使用しています。Caliburn Micro - TextBoxのテキストは表示されません

このチュートリアルでは、初期化後に値 '50'が表示されるアプリを示しています。これまでのコードである。ここ

enter image description here

App.xaml

<Application 
xmlns:local="clr-namespace:CaliburnMicroApp" 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
x:Class=" CaliburnMicroApp.App"> 
<Application.Resources> 
    <ResourceDictionary> 
     <ResourceDictionary.MergedDictionaries> 
      <ResourceDictionary> 
       <local:AppBootstrapper x:Key="bootstrapper" /> 
      </ResourceDictionary> 
     </ResourceDictionary.MergedDictionaries> 
    </ResourceDictionary> 
</Application.Resources> 

AppViewModel.cs

私のアプリはこれを示してい
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using Caliburn.Micro; 

namespace CaliburnMicroApp.ViewModels 
{ 
    class AppViewModel : PropertyChangedBase 
    { 
     private int _count = 50; 

     private int Count 
     { 
      get { return _count; } 
      set 
      { 
       _count = value; 
       NotifyOfPropertyChange(() => Count); 
       NotifyOfPropertyChange(() => CanIncrementCount); 
      } 
     } 

     public void IncrementCount() 
     { 
      Count++; 
     } 

     public bool CanIncrementCount 
     { 
      get { return Count < 100; } 
     } 
    } 
} 

AppView.xaml

<UserControl x:Class="CaliburnMicroApp.Views.AppView" 
      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"> 
    <Grid Width="300" Height="300" Background="LightBlue"> 
     <RepeatButton Name="IncrementCount" Content="Up" Margin="15" VerticalAlignment="Top" /> 
     <TextBlock Name="Count" Margin="20" FontSize="150" VerticalAlignment="Center" HorizontalAlignment="Center" /> 
    </Grid> 
</UserControl> 

AppBootstrapper.cs

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using Caliburn.Micro; 
using CaliburnMicroApp.ViewModels; 
using System.Windows; 


namespace CaliburnMicroApp 
{ 
    public class AppBootstrapper : Caliburn.Micro.BootstrapperBase 
    { 
     public AppBootstrapper() 
     { 
      Initialize(); 
     } 

     protected override void OnStartup(object sender, StartupEventArgs e) 
     { 
      DisplayRootViewFor<AppViewModel>(); 
     } 
    } 
} 

答えて

5
を公開し、あなたのAppViewModelであなたのCountプロパティを変更します

+2

どのような骨頭...ありがとうRicardo – TheLastGIS

+1

Eheh、問題ありません。時にはそれらは開発者として悩まされているエラーです;) –

関連する問題