2016-06-14 6 views
0

Ich habe ein Problem beim Bestimmen, welche Art von Bezeichner im folgenden Code verwendet werden soll. Ich habe das Codebeispiel von Microsoft UWP blogC++: Welche Art von Identifier soll verwendet werden?

genommen Aber ich kann nicht scheinen zu verstehen, wie man es implementiert? Also bitte hilf mir es richtig zu machen. Dank

stackCount // is undefined in following code. 


void StartPage::OnNavigatedTo(NavigationEventArgs^ e) 
{ 
    auto rootFrame = dynamic_cast<Windows::UI::Xaml::Controls::Frame^>(Window::Current->Content); 

    Platform::String^ myPages = ""; 

    if (rootFrame == nullptr) 
     return; 

    for each (PageStackEntry^ page in rootFrame->BackStack) 
    { 
     myPages += page->SourcePageType.ToString() + "\n"; 
    } 

    stackCount->Text = myPages; // stackCount is undefined here 

    if (rootFrame->CanGoBack) 
    { 
     // If we have pages in our in-app backstack and have opted in to showing back, do so 
     Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->AppViewBackButtonVisibility = 
     Windows::UI::Core::AppViewBackButtonVisibility::Visible; 
    } 
    else 
    { 
     // Remove the UI from the title bar if there are no pages in our in-app back stack 
     Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->AppViewBackButtonVisibility = 
     Windows::UI::Core::AppViewBackButtonVisibility::Collapsed; 
    } 
} 
+0

das ist C++/CLI, nicht C++ –

+0

Was ist der genaue Text des Fehlers? –

+0

stackCount ist nicht definiert. –

Antwort

1

Vermutlich stackCount ist ein mehrzeiliges TextBlock gegeben, dass die Probe stellt die Text Eigenschaft. Fügen Sie es auf Ihrer XAML-Seite hinzu.

+0

Ich habe 'stackCount' in' string' geändert und es hat funktioniert. –

Verwandte Themen