2015-01-06 5 views
0

catel 4를 기반으로 간단한 응용 프로그램을 실행하려고하지만 창을 표시하지 않았습니다. 오류 또는 경고가 없습니다.catel을 기반으로하는 간단한 응용 프로그램을 실행할 수 없습니다. 4

다음은 테스트 응용 프로그램 코드와 응용 프로그램 자체입니다.

내가 잘못 뭐하는 거지
<catel:DataWindow x:Class="WpfApplication1.MainWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:catel="http://catel.codeplex.com" 
    Title="MainWindow" Height="350" Width="525"> 
<Grid> 
    <CheckBox Content="Check me to continue" IsChecked="{Binding UserAgreedToContinue, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" /> 
</Grid> 

public partial class MainWindow : DataWindow 
{ 
    public MainWindow() 
     : base(DataWindowMode.Custom) 
    { 
     InitializeComponent(); 
    } 
} 
public class MainWindowViewModel : ViewModelBase 
{ 
    public override string Title { get { return "Just acknowledge"; } } 

    public bool UserAgreedToContinue 
    { 
     get { return GetValue<bool>(UserAgreedToContinueProperty); } 
     set { SetValue(UserAgreedToContinueProperty, value); } 
    } 

    public static readonly PropertyData UserAgreedToContinueProperty = RegisterProperty("UserAgreedToContinue", typeof(bool)); 
} 

? 왜 창문을 시작하지 않는거야? 그것은 바로 무엇이 잘못되었는지를 보여줍니다

public App() 
    { 
#if DEBUG 
     LogManager.AddDebugListener(); 
#endif 
    } 

: https://www.dropbox.com/s/qjf1khq10y606ql/WpfApplication1.zip?dl=0

답변

0

디버그 로그 수신기를 사용

뷰의 뷰 모델 'WpfApplication1.MainWindow' 확인할 수 없습니다. 당신은 일반적으로 MVVM에서 사용되는 네임 스페이스가 없기 때문에 수동으로

이 인 뷰와 뷰 모델을 IViewModelLocator을 사용자 정의하거나 등록해야합니다. 당신은 물론 customize everything의 수 있습니다하지만 당신은 초보자이기 때문에, 나는 다음과 같은 작업 추천 :

  • 이동보기 WpfApplication1.Views 네임 스페이스에 WpfApplication1.ViewModels 네임 스페이스에

    1. 이동 뷰 모델 (XAML과 코드 숨김 모두) App.xaml에서
    2. 변경 시작 URI는 "/Views/MainWindow.xaml"

    또한 강하게 당신이 getting started guide을 읽을 것을 권장합니다.