I am using WinUI3 on C++ windows app. And I have to pass TextGetOptions
to TextDocument().GetText()
according to the document and visual studio intellisense.
void MainWindow::TextPreviewKeyDown(IInspectable const& sender, KeyRoutedEventArgs const& e)
{
RichEditBox richEditBox = sender.as<RichEditBox>();
hstring OldText;
richEditBox.TextDocument().GetText(TextGetOptions::None, OldText);//First Argument
}
But the intellesense shows error for TextGetOptions::None
. It says: “Argument for winrt::Windows::UI::Text::TextGetOptions
is incompatible with the argument of const winrt::Microsoft::UI::Text::TextGetOptions &
“
Here is the method of GetText()
void GetText(TextGetOptions const& options, [Out] winrt::hstring const& & value);
I have been using WinUI3 with C# for a long time but I am not familiar with WinUI3 in C++. I only know that “&” means the pointer of options. And the answer from Bing Copilot is simply the same as what I did. How can I solve this?