Questions tagged [winrt-xaml]
This tag is for the XAML UI framework specific to Windows-Store-Apps on Windows-8. WinRT-XAML is a subset of the general XAML specification and a superset of Windows-Phone-8 XAML.
3,984
questions
0
votes
1
answer
81
views
WinUI3 CheckBox content style
I'm trying to change the color of a CheckBox text, but it doesn't work. Here is what I tried:
<CheckBox x:Name="OptionCheckBox"
Foreground="#FFFFFFF"
Content=...
0
votes
0
answers
47
views
XAML and ViewModel Binding inside ControlTemplate
I want to utilize the ViewModel function within the .xaml.cpp and .xaml file. I have created the ViewModel's getter and setter functions and attempted to bind it within the controlTemplate, where it ...
0
votes
1
answer
70
views
Changing the opacity of RichEditBox SelectionHighlightColor is not working in uwp?
changing the opacity of the RichEdibBox's SelectionHighlightColor is not working,
this.editor.SelectionHighlightColor.Opacity = 0.1;
0
votes
0
answers
99
views
Adding a WinUI/WinRT Xaml form to a standard C++ library
I am developing a platform independent C++20 library (pure C++, no windows component) in VS2022, which among other things has a standardized error and message reporting subsystem.
While the whole ...
0
votes
2
answers
136
views
WinUI 3 How to make DataTemplate usable in all pages?
WinUI 3 c++/winrt. The DataTemplate is listed at the top of the page:
<Page.Resources>
<DataTemplate x:Key="SomeViewTemplate" x:DataType="local:SomeModel">
&...
0
votes
2
answers
37
views
UWP "form" validation event
I have a StackPanel of basic input controls. Some combinations selections are invalid. I would like to recompute the "form"s validation every time one of the inputs change. Is there some ...
0
votes
1
answer
17
views
Data binding through UserControl
Here's a minimal example of data binding. I would like know how to factor out both the ToggleSwitch and Button into different UserControls while keeping the data binding.
//MainWindow.xaml
<...
0
votes
1
answer
57
views
in c++ winrt NavigationView how do I select an item after control is populated dynamically
I am using WinUi 2.8 and I have a navigation view that is populated dynamically using MenuItemsSource Property:
<muxc:NavigationView x:Name="mainNav" MenuItemsSource="{x:Bind ...
0
votes
1
answer
31
views
How to add label to Checkbox in Windows::UI::XAML::Controls
I am new to WINDOWS UI. Trying my hands with XAML based programming through C++.
Here is the dummy piece of code that I am trying.
Stackpanel st;
CheckBox checkBox;
checkBox.Name() = L"";
st(...
0
votes
1
answer
44
views
UWP C++WinRT How to disable a single item in a GridView
I have a <GridView/> with ItemsSource bind to IObservableVector<DeviceViewModel>. I want to disable only few of the items in this GridView. How can I do that? I saw other similar questions ...
0
votes
0
answers
75
views
x:DataType does not seem to accept my custom DataType
So I am currently trying to create a list view for a bunch of sounds. I made a new file and added a "SoundListItem" class, as the datatype in another file. I cannot get XAML to accept it at ...
2
votes
1
answer
271
views
FileOpenPicker returns memory error in WinUI 3
With reference to my previous question
I am exploring WinUI3 using C++ and struggling to find information and material on different community portals.
I developed a demo app which has a window and 2 ...
2
votes
1
answer
597
views
How to get Main Window Handle on Page in WinUI 3 Using C++
I am working on a WinUI 3 demo using C++.
I want to get a Main or Native Window Handler to open a Picker within a Page.
The code block which I am using works fine on Window but it does not work on ...
0
votes
1
answer
423
views
How to navigate to a page in NavigationView in WinUI3 using C++
I am working on very simple demo of NavigationView in WinUI3 using C++.
It is very unfortunate that there is no material or tutorial available for this.
<Window
x:Class="App1.MainWindow&...
0
votes
1
answer
60
views
Any information about the default ScrollViewer for apps with DependencyObject as a parent?
MainWindow.xaml.cs
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Input;
using System.Diagnostics;
namespace TestApp3
{
public sealed partial class MainWindow : Window
{
public ...
0
votes
1
answer
85
views
How can I find namespace in xaml?
If you look at SettingsPage.xaml in a project created by TemplateStudio, you will find the following code: It doesn't work if I write the same code on the project I created without TemplateStudio. How ...
0
votes
1
answer
78
views
How can I dynamically apply Lightweight styling to NavigationView?
Changing the NavigationViewContentMargin dynamically, which determines the top margin of the NavigationView, does not change the appearance of the NavigationView dynamically.
Is there a way to ...
0
votes
2
answers
249
views
WinUI3: Why does the top area of the NavigationView look different?
The default appearance of the NavigationView in WinUI3 Gallery or an app created with a template studio has a space at the top. However, it looks different in apps created with Visual Studio default ...
0
votes
1
answer
78
views
A Microsoft.UI.Xaml.Markup.XamlParseException occurs when rendering many CheckBoxes
I'm working on WinUI3. An UnhandledException occurs when the code below is executed and CheckBoxes are rendered.
public List<int> Collection { get; set; }
public ViewModelConstructor()
{
...
-1
votes
1
answer
147
views
How can I make a layout that looks like what I want?
I am working on WinUI3 and the code below shows the image.
<ScrollViewer HorizontalScrollBarVisibility="Auto">
<ItemsRepeater ItemsSource="{x:Bind ViewModel.Collection}&...
1
vote
0
answers
91
views
UWP ListView - How to update BringIntoView to show part of next item, in both directions
I am working on a listview of items and I need to allow user to scroll up/down but I need the bring into view handling to bring the item into view as well as a small part of the next item (in ...
1
vote
1
answer
62
views
Why are these path segments misaligned?
I'm trying to create a circle constructed of several arcs using several XAML Path objects (declared in code). The problem is that upon drawing them, the paths end up misaligned, as shown in the ...
0
votes
1
answer
136
views
Using {x: Bind} to bind to an XAML property, i.e. replacing {TemplateBinding XAMLProperty}
It is stated in MSDN that
Starting with Windows 10, version 1809, you can use the x:Bind markup extension anywhere you use TemplateBinding in a ControlTemplate.
However, when I try to replace ...
1
vote
1
answer
257
views
How can I programatically set Path geometry using C++/WinRT + WinUI 3
After decades of writing MFC apps, I'm trying to learn C++/WinRT and WinUI 3. To do this, I'm working through Petzold's "Programming Windows" 6th edition, converting the code from C# to C++/...
-1
votes
1
answer
248
views
How to get the compositor instance while handling XamlCompositionBrushBase.OnConnected in a WinUI-3 desktop app
Following this c++ example i'm trying to create a custom brush in a WinUI 3 desktop application but i cannot find out how to get a compositor instance from within the OnConnected Method.
The example ...
1
vote
0
answers
119
views
"Edit a copy" option disabled in Visual Studio for custom control
I created a custom user control "controls:MyControl" using xaml and winrt/c++. This control is part of a nuget package.
To test for further modification from user side, I added the package ...
1
vote
0
answers
73
views
"Failed to end tracking the pointer, because it is not being tracked" exception in PointerPressed
I am getting the above mentioned exception in PointerPressed that too only in the case of MFC application hosted using XAML Islands. In normal UWP application it is working fine. Essentially no other ...
1
vote
1
answer
476
views
How to get a control's handle in WinUI3 in C++?
I am working on a C++ WinUI3 project and got this problem. How do I obtain the handle of a XAML grid?
Something like this in QT can achieve it:
HWND m_hWnd;
m_hWnd = (HWND)(ui.label->winId());
But ...
-1
votes
1
answer
104
views
Converting an IInspectable to a RenderingEventArgs
How do you convert an IInspectable reference to a RenderingEventArgs in the following taken from the full xaml_app code below?
CompositionTarget::Rendering(EventHandler::new(move |_, args: &Option&...
1
vote
1
answer
100
views
Handle SwapChainPanel in ListView
I have my xaml code
<ListView x:Name="ListVideo"
ItemsSource="{x:Bind ScreenList}"
VerticalAlignment="Stretch"
FlowDirection=&...
3
votes
0
answers
241
views
Get app HWND from UIElement section Xaml Island WinRT/C++
How to get the HWND part used for hosting the UIElement from a UWP project on a XamlIsland WinRT/C++ based application? The HWND I mean can be:
Desktop application
Window or other UI element (HWND)
...
1
vote
0
answers
217
views
Access denied when initializing FileOpenPicker with HWND
I was following https://stackoverflow.com/a/57599016/8800839 to register the window to the filepicker, because I ran into the same problem.
While doing so, I get an "Access Denied" error ...
0
votes
1
answer
154
views
How to close ComboBox list items when moving application window of my WinRT/C++ UWP application?
I have a pair of ComboBox controls having IsEditable() true as well as false.
When I am scrolling through my application or moving my application window (by clicking on the title bar) with list popup ...
0
votes
2
answers
62
views
ContentPresenter's "Content" not centrally aligned vertically in UWP Controls
I am using a ToggleSwitch control to display 2 exclusive options in the application. Unfortunately, when FontSize increases the "Content" part seems to be not centrally aligned vertically.
...
0
votes
1
answer
2k
views
"LNK2019: unresolved external symbol" error resolution suggestions
Checked already asked questions but coudn't find a solution to this.
I am trying to reproduce the example provided in https://learn.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Media.Animation....
1
vote
1
answer
100
views
UWP: how to reflow controls based on grid width
I have two buttons placed horizontally. They are inside a grid. This grid containing two buttons has width 370. When the text on the button becomes large, it needs width more than 370. So what I want ...
1
vote
0
answers
175
views
UWP: How to subscribe to LayoutUpdated in C++WinRT
I am trying to subscribe to event LayoutUpdated in UWP C++WinRT app. I have following code
code behind .h
event_token layoutUpdatedToken{};
void MyLayoutUpdated(Windows::Foundation::IInspectable const&...
1
vote
1
answer
107
views
Is it possible to change the color of the highlighted text in UWP XAML?
By setting a "SelectionHighlightColor" we can set the color of highlight but I wish to change the font color of text which is being highlighted. Is there any workaround to achieve this, as I ...
1
vote
1
answer
120
views
What is the equivalent of .Net Double.PositiveInfinity in C++WinRT?
If at all there is. And if not, what should be passed to functions like
var tb = new TextBlock { Text = "Text", FontSize = 10 };
tb.Measure(new Size(Double.PositiveInfinity, Double....
0
votes
0
answers
60
views
UWP: Lifecycle event when the content on elements becomes available when content is set using async
I have UWP page and it is using data binding to set content on xaml elements (texts, buttons, image). I am setting the content using async calls (getting content from internet). In the page's c'tor, I ...
0
votes
1
answer
182
views
How to avoid text on a button from being cut off in UWP xaml
I have a button with MinWidth set as MinWidth="118" and that works fine. But when I change the Text size in windows using Settings -> Accessibility -> Text Size -> change it to 200%,...
0
votes
1
answer
56
views
Why I am getting C3646 on an IAsyncAction declaration?
Probably a dumb question (WinRT noob), but, here is goes...
The code from "App.xaml.h" is:
namespace winrt::Precog::implementation
{
struct App : AppT<App>
{
App();
...
0
votes
1
answer
74
views
In my UWP application ComboBox, PointerExited event fired right after we click on the control when IsEditable is False
There seems to be a similar question but it is not resolved.
I am using a ComboBox in my WinRT/C++ application and need to show the cursor as Hand while hovering over it. The issue is that while ...
0
votes
0
answers
696
views
Cannot compile WinUI 3.0 app that references a custom Windows Runtime component
I have a Visual Studio 2019 solution that contains two project.
The first project has been created using the "Windows Runtime Component (WinUI 3) Visual Studio template (library project). It ...
1
vote
1
answer
225
views
x:Bind to ActualWidth does not appear to work
I'm programming C# UWP. I have a UserControl with the following sample code:
<UserControl
x:Class="Sample.AllocPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/...
0
votes
0
answers
287
views
Visual Studio C++/WinRT Core App vs Blank App
If you are aiming to write a multi-threaded application with some intensive non-graphics background threads as well as a Direct3D based presentation layer which of the two Visual Studio templates Core ...
2
votes
1
answer
82
views
Crash when using HyperlinkButton with empty NavigateUri
I am trying to use HyperlinkButton in my uwp app. And I am setting “NavigateUri” later in the lifecycle of the control. Default value of “ViewModel.SecondaryLink” in the below code snippet is empty. ...
0
votes
1
answer
1k
views
How to convert winrt::hstring to int in C++ Winui application?
I have used the template called Blank App, Package (Winui 3 in desktop) inside Visual Studio. I want to make a really simple function which add 2 value together. This is what the application looks ...
1
vote
0
answers
403
views
error : Project "" does not contain any configuration
I have created a simple static library using Blank app template from this extension https://marketplace.visualstudio.com/items?itemName=CppWinRTTeam.cppwinrt101804264
I have customized the project a ...
0
votes
0
answers
174
views
Can I debug UWP winrt libraries? Does Microsoft provide symbol files for those libraries?
I am running into problems while developing a UWP app. So I was wondering if Windows provides symbol files for winrt components. Particularly I am looking to step into the function ...