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;
}
}
das ist C++/CLI, nicht C++ –
Was ist der genaue Text des Fehlers? –
stackCount ist nicht definiert. –