c++-cx

How to make isTextSearchEnabled property work in case of ComboBox with icons in the beginning of text?

牧云@^-^@ 提交于 2021-01-29 11:11:49
问题 In a ComboBox, we can jump to an item by typing its first few letters. This is when IsTextSearchEnabled property is set, which by default is true. I have a custom ComboBox with images in the beginning, followed by a short text. icon1 + Violet icon2 + Red icon3 + Blue If I type "r", I expect to navigate to the Red item in the dropdown. However, because of an icon in the beginning, the IsTextSearchEnabled property does not behave as expected. How can I make this work? For example, in MyDropdown

Combox first row not selectable

时间秒杀一切 提交于 2021-01-28 09:00:19
问题 How to make first row of combobox not-selectable? (https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Controls.ComboBox?view=winrt-19041) 回答1: Combox first row not selectable You could detect DropDownOpened event and find the fist item with ContainerFromIndex then disable it like the following. Because Combobox dropdown is lazy load, so we need add the task delay in DropDownOpened event. private async void MyCb_DropDownOpened(object sender, object e) { await Task.Delay(100); var item =

How to know that camera is currently being used by another application with UWP?

早过忘川 提交于 2021-01-28 05:53:50
问题 I am trying to show error message "Cannot setup camera; currently being using" when there is already a process running the camera. I have the code that starts the preview using the MediaCapture and it works fine when running without another application using camera. I do get the exception 0x40080201: WinRT originate error (parameters: 0xC00D3704, 0x00000049, 0x10EFF1CC) in my logs but my try catch block doesn't catch the error. create_task(_mediaCapture->StartPreviewToCustomSinkAsync(encoding

custom attached property not found

丶灬走出姿态 提交于 2020-01-22 02:34:15
问题 I want to implement a new property (named "MenuForeground") for the pivot element, in order change the color of the PivotItem header through a defined ControlTemplate. Therefore I created a new class for the custom property, added the #include in the needed code-behind xaml.h file and defined a new namespace ("xamlns:cap") according to the namespace of the custom property. PivotProperties.h #pragma once using namespace Windows::UI::Xaml; namespace CustomAttachedProperties { public ref class

Function Pointers in C++/CX

杀马特。学长 韩版系。学妹 提交于 2020-01-16 04:53:14
问题 Background I'm writing a Windows Store App in C++ using the Windows Store Unit Test Project. While trying to figure out how to test that an exception was raised, I found Assert::ExpectedException in CppUnitTestAssert.h. Its signatures are below: template<typename _EXPECTEDEXCEPTION, typename _RETURNTYPE> static void ExpectException(_RETURNTYPE (*func)(), const wchar_t* message = NULL, const __LineInfo* pLineInfo = NULL) { ... } and template<typename _EXPECTEDEXCEPTION, typename _FUNCTOR>

How to return value from nested task in c++/cx?

我与影子孤独终老i 提交于 2020-01-16 02:33:11
问题 I have a bunch of threaded tasks like this after each other: create_task(somewinrtasyncfunction()).then([this(variable_that_the_last_task_returned) { //task here return info; }).then([this](info) { //another task here return status}); Now I want to use status outside the tasks, in the function that called it. How would I access it? 回答1: You return the task (or value) created by create_task(...).then(...).then(...) . If you need to get the result synchronously, you can try calling .get() on

How to convert Platform::String to char*?

允我心安 提交于 2020-01-09 03:49:27
问题 How do I convert the contents of a Platform::String to be used by functions that expect a char* based string? I'm assuming WinRT provides helper functions for this but I just can't find them. Thanks! 回答1: Platform::String::Data() will return a wchar_t const* pointing to the contents of the string (similar to std::wstring::c_str() ). Platform::String represents an immutable string, so there's no accessor to get a wchar_t* . You'll need to copy its contents, e.g. into a std::wstring , to make

Audio sample adding to a video using Sink Writer in Windows Media Foundation

Deadly 提交于 2020-01-06 02:08:05
问题 I can write a video file using images which I learned with this sample here. It uses IMFSample and IMFSinkWriter . Now I want to add audio to it. Suppose there is Audio.wma file and I want this audio to be written in that video file. But cannot figure out how to do that in this sample. Things like input & output type setup, IMFSample creation for audio buffer etc. It would be a great if someone could show me how to add audio to a video file using sink writer. 回答1: Media Foundation is great to

How does one make function calls or trigger events from a Native component into a C#/XAML component?

自作多情 提交于 2020-01-02 19:47:29
问题 I am developing a WP8 application with a Native (DirectX/D3D) component and a C#/XAML component. The Native component draws to a UI element and the C#/XAML component has the controls of the app (and other things) surrounding it. Usually, I send information from the C#/XAML component down to the Native component. But there are certain times when I would like to trigger events in the C#/XAML component based on when processing is done in the Native component. In one planned feature, I envision a

Listview selection display with no padding and no checkmark

假如想象 提交于 2019-12-28 13:38:44
问题 I have this XAML to display a ListView in a C++/CX code. The ListView will be used as a selection menu. <ListView x:Name="itemsListView" ItemsSource="{Binding Source={StaticResource MenuDataSourceCVS}}" HorizontalAlignment="Stretch" Width="230" Margin="0,45,0,0" VerticalAlignment="Top" Grid.Row="1" SelectionChanged="itemsListView_SelectionChanged" SelectionMode="Single" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" FontFamily="Global User Interface"> <ListView