I have a WPF project with only these changes from an empty project:
- This line added to the .csproj:
<TargetPlatformVersion>8.0</TargetPlatformVersion> - A reference added to
Windows - A button with a Click handler executing this:
SearchPane.GetForCurrentView().Show("test");
When I click the button, I have an exception when calling .GetForCurrentView():
Element not found. (Exception from HRESULT: 0x80070490)
What can I do to diagnose it and make it work?
Details:
Note that I have no breakpoints, I'm running on Windows 8.1 and I already tried:
- Adding
await BackgroundExecutionManager.RequestAccessAsync();before; - Adding a 1000ms delay;
- Referencing
System.Runtime,System.Runtime.WindowsRuntimeandSystem.Runtime.InteropServices.WindowsRuntime
I know I can use SendKeys to send Win + S + (query), but this is exactly what I'm trying to replace since at the moment I try to open the search charm, the Ctrl key will be down (launched by a shortcut).