microsoft-ui-xaml | Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications | Runtime Evironment library
kandi X-RAY | microsoft-ui-xaml Summary
kandi X-RAY | microsoft-ui-xaml Summary
Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of microsoft-ui-xaml
microsoft-ui-xaml Key Features
microsoft-ui-xaml Examples and Code Snippets
Community Discussions
Trending Discussions on microsoft-ui-xaml
QUESTION
There is some strange behavior with XAML x:Bind and attempting to bind to a nullable int:
Binding defintions:
...ANSWER
Answered 2022-Jan-10 at 19:09x:Bind
doesn't currently handle null
values correctly. As stated in this GitHub issue from 2020, they "will look at fixing this post WinUI 3.0".
QUESTION
My app builds fine. Attempting to start it in debug mode, however, causes this error. This appeared after I solved an error relating to missing "debug symbols" similar to the one here (enabling the remote symbol servers in the options and then building caused this error to appear instead - this behavior persisted even after turning off the remote symbol servers in the options again).
I am using WinUI3 project on Visual Studio 2022 on Windows 11.
This post seems to suggest the issue was using WPF - but I am not using WPF. I also see a potentially similar issue here, but there appear to be no answers.
I am not sure where to even begin fixing this - it seems to be a Visual Studio issue or a project/solution config issue rather than a code issue. Any ideas?
...ANSWER
Answered 2021-Dec-01 at 07:48I fixed it. I was looking at the output in the Visual Studio Console (after stopping the app once the error mentioned in the question happened), and I saw this:
Exception thrown at 0x00007FFD41D4466C (KernelBase.dll) in EmailClient.exe: WinRT originate error - 0x80004005 : 'WinUI: Error creating second Desktop Window on the current process. No more than one Desktop Window is allowed per process.'. onecore\com\combase\winrt\error\restrictederror.cpp(1017)\combase.dll!00007FFD43EAA21E: (caller: 00007FFD43D9A2F3) ReturnHr(2) tid(5e98) 8007007E The specified module could not be found.
I then searched through my project, and found out I was calling new MainWindow()
one place in my project outside of the App.xaml.cs when initializing a property. I removed that (initializing the property to null
instead), and now the app works fine. Not sure how the two are related... but this may be an unexpected behavior caused by attempting to create multiple windows on the same process. Here is someone else who had the same issue.
If your intention is to create multiple windows (mine was not) and you want to know how, then see this thread (a few months out-of-date... not sure if the mentioned features are still in preview or not as of time of posting).
QUESTION
My solution structure looks like this:
The compiler complains that it finds duplicate types (of every public interface/class) in WCL1.winmd b/c that winmd file already exists in WCL4's bin directory.
One problem is that I know absolutely nothing about C++ and the link offered in the Answer to this question provides a C++ workaround that doesn't help (it's literally like reading a different-but-related language -- i.e. reading German when I only know English).
I also found this which provides another workaround but doesn't tell you where to put it. I added the specified ItemGroupDescription element into every .csproj file as well as the application's PropertySheet.props file to no avail.
I have also done the following:
- Moved the code from WCL2 into WCL3 and removed WCL2 from the solution.
- Had the application reference WCL1, WCL3 and WCL4.
Anyone else got any ideas? It would be greatly appreciated....
UPDATE:
Here's a link to a small solution that reproduces the compile errors. It seems that it comes from the Microsoft.Windows.CppWinRT NuGet package referenced by the C++ Application. That package auto-generates C++ header files from the .winmd files generated by the component projects referenced by the Application.
...ANSWER
Answered 2021-Nov-12 at 22:26Well....it's not perfect but this is how I got around the problem...Add the following line to each ProjectReference in each Component .csproj file:
I'm not sure what the intention of this particular Xml element was, but by setting Private=false, the compiler doesn't copy the InterfaceDefinitionComponent.winmd file into the other Components' bin directory which prevents the C++ compiler from seeing duplicate .winmd files and blowing up because it's trying to generate multiple identical C++ header files for the same Type.
QUESTION
In a WinUI 3 in Desktop app I have a property to update which is bound to the ui via x:Bind
.
I want to use the Dispatcher
like I do in WPF to get on the UI thread and avoid the thread error im getting when I update the prop:
System.Runtime.InteropServices.COMException: 'The application called an interface that was marshalled for a different thread. (0x8001010E (RPC_E_WRONG_THREAD))'
Im just not sure how to do it in WinUI 3, when I try
...ANSWER
Answered 2021-Nov-10 at 16:02DispatcherQueue.GetForCurrentThread()
only returns a DispatcherQueue
when being called on a thread that actually has a DispatcherQueue
. If you call it on a background thread there is indeed no DispatcherQueue
to be returned.
So the trick is to call the method on the UI thread and store the return value in a variable that you then use from the background thread, e.g.:
QUESTION
I have created the custom controls. I have did the code changes to fix the issue in the AppWindow by setting the XamlRoot. But what's my problem is XamlRoot is available only in latest version.
So I changed the source target version to the latest version. When I create the UWP app with the same version of custom control, it works fine. But when the UWP project version has a lower target version (which doesn't support XamlRoot), I have got an exception:
Method Not Found
I have checked the conditions to execute the XamlRoot code only when targetversion is higher. But it does not work. I have tried with ApiInformation
, but it is also of no use, since this is only to make the UWP app compatible for every device and not depends on the App TargetVersion.
Please refer the below code which I uses to fix the issue in the popUp
...ANSWER
Answered 2021-Apr-14 at 03:03Based on the XamlRoot class, it requires Windows 10, version 1903 or higher. You could not find this object in the lower version of UWP. You have to set the min version as 1903 to avoid compile issue.
QUESTION
In the ctor of the code-behind we have the code below copied from microsoft-ui-xaml-specs
...ANSWER
Answered 2020-Nov-20 at 21:50If you have registered for the WebMessageReceived event but aren't seeing your event handler run you might check the following:
- Ensure you register for the WebMessageReceived event before the webpage you load executes the
chrome.webview.postMessage
. If you register the event handler after the page posts the message, the event handler won't fire. Similarly, you must watch out for races. For instance, if you navigate to a page that executes postMessage while the page is loading and then register the WebMessageReceived event there's no guarantee which will finish first and you may or may not receive the message. - Ensure the code in your page is actually running
chrome.webview.postMessage
and successfully. You can use the DevTools in the WebView2 to put a breakpoint on that line of code in your page and validate that it executes and that you don't throw an exception before running that code.
QUESTION
I have this code:
...ANSWER
Answered 2020-Nov-12 at 16:26As noted on the Grid Docs page the default value for Width
(or Height
in the case of RowDefinitions
) is *
.
The default value of the RowDefinition.Height property is *. Similarly, the default value of the ColumnDefinition.Width property is *. Therefore, it's not necessary to set these properties in cases where these defaults are acceptable.
(from the first "Important" box on the page at the time of writing)
That means, whenever you don't specify the property explicitly, the value is *
. So when you want to use the short-hand notation you would need to use *
QUESTION
I created a new UWP project with a NavigationView
(winui 2.4) in MainPage.xaml.
I proceeded by binding a hierarchical ObservableCollection
to populate the NavigationView
menu items (1 parent, 4 children)
Launching the application, the hierarchical structure renders as expected, and seem to be working fine.
My next objective would be to collapse every expanded menu item clicking on a button. To do so, the docs suggest using NavigationView.Collapse(NavigationViewItem)
: my intention would be to iterate through NavigationView.MenuItems
and collapse them.
The issue is that it seems NavigationView.MenuItems
returns empty and I cannot figure out why.
I included a Button that prints NavigationView.MenuItems.Count()
, which returns 0.
On the other hand, hard-coding the hierarchical menu items and repeating said procedure seem to work fine.
MainPage.xaml
...ANSWER
Answered 2020-Nov-13 at 02:20UWP: NavigationView.MenuItems results empty if populated programmatically
I can reproduce your problem that MenuItems.Count is zero. As your provide link said, you could also get the items with MenuItemsSource
property.
The parameter of Collapse
method is NavigationViewItem
, and we could not pass MenuItems element (data source type) into it directly. We need use the data source to find the matched NavigationViewItem
, the ContainerFromMenuItem
method is right choice for getting NavigationViewItem with data source. And then MenuItems
is not necessary for this scenario. Because categories
has been decaled previously. we could use it directly. So the code could be written like below.
QUESTION
I have come across a layout / template problem with CommandBar
of which symptoms are seen in several pages:
- UWP - CommandBar blank space under Buttons
- https://github.com/microsoft/microsoft-ui-xaml/issues/1024
It seems that the UWP CommandBar
elements inside the CommandBar
have an actual height of 44px, which is cropped in a control of 40px.
- When
IsOpen="False"
, theAppBarButton
s are vertically centered and the bottom 4px of theCommandBar.Content
section is not shown - When
IsOpen="Top"
, theAppBarButton
s are shifted up, an ugly gap appears under them and the bottom 4px of theCommandBar.Content
section is suddenly shown
Besides the ugly gap, it makes it very difficult to correctly vertically center elements in CommandBar.Content
.
About the vertical position of the CommandBar
- When the CommandBar is at the top of the Page, the CommandBar itself does not vertically resize.
- When the CommandBar is at the bottom of the Page, the CommandBar itself grows vertically with 4px.
- In all cases, the other symptoms happen
The red line visualizes the bottom 4px of the CommandBar.Content
section. Also, with the Reveal
effect to the left of the mouse cursor you can see that the buttons shift up. The whole CommandBar grows vertically
Is there any way to workaround this issue? Microsoft has qualified this more than a year ago as something they might fix in WinUI 3 which is far away.
Bug repro repository Relevant code to reproduce ...ANSWER
Answered 2020-Oct-26 at 02:58UWP CommandBar moves vertically when IsOpen changes
During the testing, AppBarSeparator
cause this behavior. Currently there is a work around that could fix this, please give AppBarSeparator
specific height less than 40px.
QUESTION
I have an issue with the NavigationView control in my UWP app. When I set the IsPaneToggleButtonVisible to false, my PaneHeader collapses too. Offically this bug was solved, am I doing something wrong?
...ANSWER
Answered 2020-Apr-06 at 05:15Based on this thread, it mentions
This issue was addressed in #1083, which has now been successfully released as Microsoft.UI.Xaml v2.2.190731001-prerelease.
This means the bug has solved in the Windows UI Library version of NavigationView, so if you want to show your PaneHeader, you need to install the Microsoft.UI.Xaml nuget package and then add to your Application.Resources.
.App.xaml:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install microsoft-ui-xaml
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page