719 questions
105
votes
4
answers
52k
views
Basic concepts of MVVM-- what should a ViewModel do?
Trying to grasp the concepts of MVVM, I have already read several blogs and looked at a few projects.
From what I understand, a View is dumb, it just knows how to present something that is passed to ...
11
votes
4
answers
6k
views
How do I access Window Resources in WinUI 3
I've just started working on a WinUi 3 (Desktop) project and have got blocked trying to add Window resources to a Window.
I would have thought the following would work. However there appears to be no ...
10
votes
1
answer
5k
views
A WinUI 3 question about accessing the UI thread from another thread
A WinUI 3 question about accessing the UI thread from another thread, say, a Timer tick.
In WinForms that was extremely easy with a (someControl).InvokeRequired and .Invoke.
In WPF we had to add ....
9
votes
1
answer
3k
views
MSIX packages on Windows Sandbox?
I'm trying to work out how to package a WinUI desktop application in MSIX. We don't want to upload to Windows Store or anything, just to be able to give people an installer (much like a .msi file), ...
7
votes
1
answer
8k
views
Right way to publish WinUI3 app in single .exe file
I have created a project in winui3, however, I just can't find a way to publish the application into a single .exe file.
When I use the JetBrains rider to publish single .exe file, it just doesn't ...
7
votes
1
answer
2k
views
How do I get a WinUI Control's parent Window?
I need to get a reference to the parent Microsoft.UI.Xaml.Window for a Control. Is there a way to do that in Project Reunion 0.5? Window.Current does not work in a desktop app.
6
votes
1
answer
4k
views
Content Dialog not showing up WINUI3
I'm trying to show a popup to edit a brand in my app but it doesn't show up.
Function where I call the Dialog:
private async Task EditBrandAsync(Brand brand)
{
var dialog = new ContentDialogs....
6
votes
2
answers
3k
views
UWP/WinUI desktop app access to Azure Key Vault secrets
Microsoft provides several ways to gain secure access to Azure Key Vault secrets, particularly using Managed Identity or Service Principals as identity providers. However, these methods are explicitly ...
5
votes
3
answers
11k
views
C# CommunityToolkit.Mvvm ObservableProperty on a list
I want to try the Community Toolkit 8.0 the MVVM part.
I have a very simple application:
....
d:DataContext="{d:DesignInstance Type=local:MainWindowViewModel}"
....
<Grid>
...
5
votes
3
answers
3k
views
URI start of MAUI Windows app creates a new instance. I need to have only one instance of app
I am able to start my Windows MAUI app using an URI, and I can get the URI itself. But, it appears that a NEW instance of the app is being created. This is not ideal for me -- if my app is already ...
5
votes
1
answer
3k
views
What is the difference between FallbackValue and TargetNullValue in UWP and WinUI 3?
can someone please tell me the exact difference between FallbackValue and TargetNullValue? I know they are quite similar, but I'd like to understand more about those edge usecases where you want to ...
5
votes
4
answers
3k
views
Is it possible to publish an unpackaged Windows App SDK (WinUI 3) as self contained single file?
I'm pretty sure I have all the right flags and everything set according to Microsoft Docs, however the UI dlls are not being included in the single file exe.
4
votes
1
answer
3k
views
Where is the generic.xaml file located?
If you want to use the default styles, colors, etc..., you need to bring them from the generic.xaml file that comes with WindowsAppSDK NuGet packages.
Hence the question, where is located the generic....
4
votes
1
answer
1k
views
Cannot find namespace 'CommunityToolkit.WinUI.Controls' in WinUI 3 project with .NET 8
enter image description here
I'm developing an application using WinUI 3 with .NET Core 8 and have installed CommunityToolkit.WinUI.Controls, but I'm encountering errors when trying to use ...
4
votes
3
answers
2k
views
Error NETSDK1152 on WinUI3 App: Found multiple publish output files with the same relative path: Microsoft.Web.WebView2.Core.dll
Installed Visual Studio 2022 (on a clean/fresh Windows 11 installation), installed Template Studio for WinUI (v5.3).
Created a Project using Template Studio with these Settings:
- Project type: ...
4
votes
3
answers
3k
views
How can I remove the close button in WinUI 3?
How can I remove the close button in WinUI 3?
Screenshot of WinUI 3 App
4
votes
1
answer
3k
views
WinUI 3 Can't properly change the background colour of the titlebar
My aim is to make the background colour of the title bar and the content inside the app to be the same colour, but that is not working.
I wanted to make everything of this colour #FF2B2B2B, the ...
4
votes
1
answer
816
views
Changing the stroke color of a rendered svg file at runtime?
I'm trying to create some scalable buttons in a WinUI application using svg files. I've achieved this at the moment using an image control as the button's context, similar to the below:
<Button ...
4
votes
0
answers
223
views
Default constructor argument in custom markup extensions
I've got a custom MarkupExtension FooBinding.
public class FooBinding : MarkupExtension
{
public PropertyPath Path { get; set; }
public FooBinding(string path)
{
Path = new ...
4
votes
0
answers
262
views
Cross-platform .NET webview with cookie and javascript support
I'm developing a cross-platform graphical desktop application in .NET 5. I'm currently using UNO Platform and WinUI 3 preview 3. I need to authenticate users to a remote website and store the ...
3
votes
1
answer
917
views
How to handle activation through files in WinUI 3 (Packaged)?
I want to define a filetype to open in my app and have already gotten this far:
I added this to my Package.appxmanifest inside the Application tag:
<Extensions>
<uap:Extension Category=&...
3
votes
1
answer
575
views
WinUI 3 (Windows App SDK) Globalized Exception Handling
In WinForms, we used the following in Main() or some other startup event:
System.Windows.Forms.Application.ThreadException += ExceptionHandler.Handle;
I searched for something similar in WinUI3 (...
3
votes
1
answer
1k
views
Error opening XAML page in designer in a WinUI 3 (Windows App SDK) project using VS2022 Pro
I have created a brand-new WinUI 3 / Windows App SDK project in VS2022 Pro using a Blank Project template. When I open MainWindow.xaml in design mode after successfully building the project I get the ...
3
votes
2
answers
3k
views
How can I make the window transparent in WinUI3?
I am developing a WinUI3 app and I want to make the window transparent. However, that doesn't seem to be easily possible anymore. In WPF I could just set AllowTransparency = "true" in my ...
3
votes
1
answer
100
views
WinUI 3 ItemsView with LinedFlowLayout items shrinking instead of wrapping
I have an ItemsView control with LinedFlowLayout inside my WinUI 3 application. I would like to make a list of "tags", but for some reason I cannot figure out, when the window is resized ...