2014-04-19 4 views
0

Visual Studio 2013 Express에서 Universal App으로 Desktop/tablet 및 Windows Phone 용 Windows 스토어 앱을 만들려고합니다. 이전 Windows 8 개발 경험이 HTML/JS 응용 프로그램과 함께 진행되어 왔기 때문에 WPF에서 어떤 일이 벌어지고 있는지 이해하는 데 어려움이 있습니다.내 WPF 페이지 컨트롤의 생성자가 호출되지 않는 이유는 무엇입니까?

새 프로젝트 -> Visual C# -> 스토어 앱 -> 범용 앱 -> 빈 앱을 만들려면 VS에 문의하십시오. MainPage.xaml.cs를 열고 this.InitializeComponent() 일 수있는 생성자 함수의 첫 번째 줄에 중단 점을 넣습니다. F5를 누르면 앱이 컴파일되고 익숙한 풀 스크린 Modern 앱보기로 전환되지만 내 브레이크 포인트 중 어느 것도 부딪치지 않습니다.

MainPage.xaml에 TextBlock을 추가하여 거기에 뭔가가 있지만 여전히 중단 점은 적중되지 않습니다. 내가 뭘 놓치고 있니? 아래는 Visual Studio에서 생성 된 코드입니다 (일부). 아마도 WPF 응용 프로그램이 어떻게 작동하고 구조화되어 있는지에 대한 근본적인 것이 빠져있을 것입니다. 그러나 모든 google-fu는 전혀 사용하지 않았습니다.

에서 MainPage.xaml :

<Page 
    x:Class="SoloCoach.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="using:SoloCoach" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" 
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> 

    <Grid> 

    </Grid> 
</Page> 

MainPage.xaml.cs를 :

using System; 
using System.Collections.Generic; 
using System.IO; 
using System.Linq; 
using System.Runtime.InteropServices.WindowsRuntime; 
using Windows.Foundation; 
using Windows.Foundation.Collections; 
using Windows.UI.Xaml; 
using Windows.UI.Xaml.Controls; 
using Windows.UI.Xaml.Controls.Primitives; 
using Windows.UI.Xaml.Data; 
using Windows.UI.Xaml.Input; 
using Windows.UI.Xaml.Media; 
using Windows.UI.Xaml.Navigation; 

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 

namespace SoloCoach 
{ 
    /// <summary> 
    /// An empty page that can be used on its own or navigated to within a Frame. 
    /// </summary> 
    public sealed partial class MainPage : Page 
    { 
     public MainPage() 
     { 
      this.InitializeComponent(); 

      this.NavigationCacheMode = NavigationCacheMode.Required; 
     } 

     /// <summary> 
     /// Invoked when this page is about to be displayed in a Frame. 
     /// </summary> 
     /// <param name="e">Event data that describes how this page was reached. 
     /// This parameter is typically used to configure the page.</param> 
     protected override void OnNavigatedTo(NavigationEventArgs e) 
     { 
      // TODO: Prepare page for display here. 

      // TODO: If your application contains multiple pages, ensure that you are 
      // handling the hardware Back button by registering for the 
      // Windows.Phone.UI.Input.HardwareButtons.BackPressed event. 
      // If you are using the NavigationHelper provided by some templates, 
      // this event is handled for you. 
     } 
    } 
} 

답변

1

당신은 그것이 생성하는 유니버설 앱을 만들 때 모두 윈도우 8.1과 윈도우 폰 8.1 응용 프로그램. 표시하는 코드는 Phone 버전의 기본 페이지 생성자이므로 실행중인 Windows Modern App이 아닌 잘못된 프로젝트에있을 수 있습니다.

+0

새끼. 나는 그것을 간과했다고 믿을 수 없다. 나는 당신에게 내 모든 의원을 양보하고이 사이트에서 은퇴 할 수 있기를 바랍니다. Stackoverflow seppuku. –

관련 문제