c++-winrt

C++ WinRT UWP XAML Data binding ItemsSource and SelectedIndex to IObservableVector<hstring> does not work

放肆的年华 提交于 2020-02-24 20:28:13
问题 I am using Visual Studio 2019 16.4.3, Microsoft.Windows.CppWinRT 2.0.200117.5, Windows 10 1809 Pro and targeting 10.0.17763.0. I am trying to port a C++/CX app to C++ WinRT. I am using data binding of the ItemsSource , SelectedIndex and SelectedItem properties of a combo box but I am running into issues. For the ItemsSource I am binding to a IObservableVector<String> . The property is implemented using IObservableVector<hstring> and initialized with single_threaded_observable_vector(std:

C++ WinRT UWP XAML Data binding ItemsSource and SelectedIndex to IObservableVector<hstring> does not work

别来无恙 提交于 2020-02-24 20:26:03
问题 I am using Visual Studio 2019 16.4.3, Microsoft.Windows.CppWinRT 2.0.200117.5, Windows 10 1809 Pro and targeting 10.0.17763.0. I am trying to port a C++/CX app to C++ WinRT. I am using data binding of the ItemsSource , SelectedIndex and SelectedItem properties of a combo box but I am running into issues. For the ItemsSource I am binding to a IObservableVector<String> . The property is implemented using IObservableVector<hstring> and initialized with single_threaded_observable_vector(std:

C++ WinRT - How to convert C++CX Array<> template to WinRT?

吃可爱长大的小学妹 提交于 2020-02-07 03:35:46
问题 How to convert the following code to C++ WinRT ? Platform::Array<bool>^ currentButtonReading = ref new Platform::Array<bool>(buttonCount); Platform::Array<GameControllerSwitchPosition>^ currentSwitchReading = ref new Platform::Array<GameControllerSwitchPosition>(switchCount); Platform::Array<double>^ currentAxisReading = ref new Platform::Array<double>(axisCount); rawGameController->GetCurrentReading( currentButtonReading, currentSwitchReading, currentAxisReading); It is from the article:

How to use midlrt.exe to compile .idl to .winmd?

爷,独闯天下 提交于 2020-01-14 04:12:26
问题 Background: I need to build a Windows Runtime Component as part of a system that's set up to use CMake to generate its build system. As a preparatory step I'm trying to build it on the command line. Starting with a bare-bones .idl file (MyType.idl) namespace NS { [default_interface] runtimeclass MyType { } } I'm trying to generate a matching .winmd file using the midlrt.exe tool. The following command line (split across several lines for readability) midlrt /metadata_dir "%WindowsSdkDir

synchronizing SDK with Windows 10 update and using WinRT with Standard C++

隐身守侯 提交于 2019-12-29 09:23:09
问题 I have started experimenting with C++/WinRT using Visual Studio 2017 Community Edition. I now have an environment in which I can build a debug version of a sample application and run it. I had to: download and install latest Windows 10 SDK update Visual Studio 2017 with the C++/WinRT package and templates update Windows 10 OS to the latest build, build 1803 Documentation and web pages described the C++/WinRT package update to Visual Studio and trying a compile of the example gave me an error

Getting “a function that returns 'auto' cannot be used before it is defined” while using CoreDispatcher::RunAsync in C++/WinRT project

送分小仙女□ 提交于 2019-12-20 06:33:30
问题 In my C++/WinRT project, I am trying to run some code on UI thread but getting an error that says: "winrt::impl::consume_Windows_UI_Core_ICoreDispatcher<winrt::Windows::UI::Core::ICoreDispatcher>::RunAsync': a function that returns 'auto' cannot be used before it is defined" I am invoking the method like this: Dispatcher().RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, [=]() { // Code to be executed. }); The implementation is coming from auto generated winrt file which returns

Errors on build creating a UWP cppwinrt SolidColorBrush

▼魔方 西西 提交于 2019-12-13 06:31:34
问题 When creating a solid brush (cppwinrt) for a textblock I get errors when building, using: void MainPage::myStyle(Controls::TextBlock & block) { block.FontSize(72.0); block.Foreground(Media::SolidColorBrush(Windows::UI::Colors::Orange())); block.VerticalAlignment(VerticalAlignment::Center); } error: LNK2019 unresolved external symbol "public: __thiscall winrt::Windows::UI::Xaml::Media::SolidColorBrush::SolidColorBrush(struct winrt::Windows::UI::Color const &)" The error goes when I take the

How to declare handler for OnPointerEntered using cppwinrt?

僤鯓⒐⒋嵵緔 提交于 2019-12-13 03:12:08
问题 In cppwinrt (xaml not yet available) I have a handler for the PointerEntered event of a Button, and it works fine. But in attempting to remove the default hover behavior of this Button, which displays as an image, it seems I may need to handle the OnPointerEntered event instead - I have seen solutions that involve using a xaml trigger and this would seem to be a code equivalent. But OnPointerEntered has a different argument list, and I can't find a way to invoke it that will build. Here is

Is it possible to use nvidia Nsight to debug cppwinrt directx12 applications?

☆樱花仙子☆ 提交于 2019-12-12 23:13:29
问题 I have a UWP cppwinrt app that is using directx12 to render a cube with a basic shader. I would like to use a graphics debugger to inspect the data being sent to this shader. First I am trying to use the Nvidia Nsight debugger for visual studio 2017. The problem is that when I go to "Start Graphics Debugging" from the Nsight menu, the app immediately stop with an error saying: "Failed to launch UWP app (Could not terminate existing process)". I am able to launch the Nsight debugger on a

How to create a XAML custom control in code?

大兔子大兔子 提交于 2019-12-12 14:23:49
问题 I am trying to implement a custom XAML control in code, using C++/WinRT. My attempted implementation, however, failed to compile. As a prove of concept I was using this code: #pragma once #include <winrt/Windows.UI.Xaml.Controls.h> namespace MyApp { struct MyControl : winrt::implements<MyControl, winrt::Windows::UI::Xaml::Controls::Control> { }; } This resulted in the following compiler error: 1>MyControl.cpp 1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\cppwinrt\winrt\base.h