170,046 questions
-2
votes
0
answers
60
views
How do I reference an assembly with '.' characters in the assembly name [closed]
I'm working on a WPF project and I want to reference another project. The project I want to reference has '.' characters in the assembly name. I've set it up this way because it's part of a set of ...
1
vote
2
answers
127
views
Why is my WPF DataGrid RowDetail ignoring SelectedItem but accepts ItemsSource?
I am using a WPF DataGrid with MVVM approach. The ItemsSource of the DataGrid is bound to an ObservableCollection of something which has an Id and an ObservableCollection of strings.
I want the Id to ...
1
vote
0
answers
85
views
WPF Modal Window renders completely white (blank) in Hybrid WinForms application under load
I am maintaining a legacy hybrid application (Main App is WinForms, hosting WPF UserControls via ElementHost).
The Problem:
When opening a WPF Modal Window (Window.ShowDialog()) from the WinForms main ...
1
vote
1
answer
85
views
.NET Framework SDK project: Launch arguments duplicated for x64 platform
I'm working on a C# .NET Framework 4.8 SDK-style project (WPF, Sdk=Microsoft.NET.Sdk).
I want to pass command-line arguments to my project when running from Visual Studio. I created a launchSettings....
-1
votes
1
answer
92
views
Is there a way to prevent part of a control template from triggering an event?
I have a ControlTemplate for a ToggleButton. What I would like to have happen is that part of the Template can be clicked to check and uncheck the ToggleButton, and part, when clicked, does not ...
1
vote
1
answer
62
views
Velopack is not updating version of WPF application
My WPF app is Windows only.
I cleared my */Releases folder and build my project:
dotnet publish --self-contained -r win-x64 -o .\publish
Then I created a release:
vpk pack --packId MyApp --...
-1
votes
0
answers
35
views
InjectSyntheticPointerInput not properly working although NUnitTest Passes
Im trying to simulate stylus properties like x, y coordinates, tilt, pressure which I have dumped in a json file. In NUnitTest im trying to simulate exactly the same json with WinAppDriver in ...
0
votes
1
answer
52
views
WPF returns UnsetValue on RelativeSource to Ancestor
I was able to create a neat context menu that controls visibility of columns and wanted to show values of hidden ones in a tooltip, but I'm unable to, because somehow the very same binding is ...
Advice
0
votes
0
replies
24
views
Ever struggled with emissive materials in WPF Viewport3D with RenderTargetBitmap? I may have discovered the answer
This is just a PSA regarding an extremely annoying issue I've solved for myself.
In WPF, if you have a Viewport3D and want to export it as an image, you'll probably want to use RenderTargetBitmap. If ...
0
votes
1
answer
121
views
Get System.Timers.Timer to fire on a WPF Window's thread using the Timer's SynchronizingObject
I tried setting the SynchronizingObject like this:
timer.SynchronizingObject = this;//The Window
but VS told me I need an explicit cast. So I did that and the error went away.
timer....
0
votes
1
answer
97
views
WPF MVVM: View XAML throws runtime exception when instantiating inventory management window
I'm creating a WPF application to manage inventory, but I'm having trouble creating the views. I'm using the MVVM pattern, and I'm getting an error when instantiating the Views XAML file.
It would be ...
Best practices
0
votes
1
replies
27
views
Dockable panel height issue revit api - wpf
I have an issue with setting the height of a Dockable Panel in Revit. I created a panel that should appear at the bottom of Revit with a fixed height (for example, 50 px). However, every time I start ...
0
votes
2
answers
119
views
method to show notification in WPF project causes an "unexpected token error"
According to the documentation available from Microsoft, the code that should show a Notification toast on Desktop looks like this
//correctly imported the Notifications library
using Microsoft....
0
votes
0
answers
69
views
WPF "View Source" in Live Visual Tree stopped working - can't open XAML or code-behind
I'm learning how the back end and front end work together by reviewing WPF (Window Presentation Foundation) code.
The project runs locally on my machine. I copied it from my team's shared folder.
My ...
0
votes
0
answers
68
views
How can I place the WPF-UI TitleBar TrailingContent on the left side?
I am using the WPF-UI (Lepo) library, and I want to move all buttons in the TitleBar.TrailingContent area to the left side, as shown in the screenshot.
Here is my current TitleBar XAML:
<ui:...
0
votes
1
answer
121
views
How to display Openstreetmap map on C# & WPF ? I only get black screen
In mainwindow.xaml.cs, I added a toggle button event to switch from current mode view to the interactive Open Google Streetmap view.
At the top I added:
using Microsoft.Web.WebView2.Core;
and then in ...
-3
votes
3
answers
133
views
WPF UserControl displaying a form with collection of UIElements
I need guidance on how to make a user control with one or more UI controls defined when the user control is used.
Let's say the user control is named MyControl. Here is the use of this control:
<...
0
votes
0
answers
130
views
How to identify cause of "Cannot convert from type '<null>' to type 'System.Uri' in WPF
I am working on an C# WPF application, containing some ~170 projects with many more .xaml files.
When starting the application via Visual Studio shows 3 XAML binding errors.
Cannot convert '<null&...
-4
votes
1
answer
182
views
Display directly on screen. Work on Windows 10 not on Windows 11
A few years ago I wrote a WPF program which displays Google Agenda items (with some transparency) directly on the screen of Windows desktop.
This program works perfectly under Windows 10, by calling ...
0
votes
0
answers
93
views
How to bind DataGridColumnHeader to its own viewmodel ObservableCollection in WPF
I built a custom DataGrid in WPF where I added filtering via popup. I initially managed all the interactions via code-behind, but recently moved to a pure MVVM approach. Everything is in a shared ...
-2
votes
0
answers
78
views
Is it possible to dynamically create buttons in WPF based on the number of devices set in an INI file? [duplicate]
Assuming the number of devices is set in the config.ini file as follows:
[Device]
Count = 10
When my WPF program starts, I want to automatically create buttons based on the Count value. For example, ...
Advice
0
votes
2
replies
118
views
Is WPF binding correct?
Everything I have is in code not XAML. Binding doesn't work. Can't see anything when I run it. This is just a small portion. Is the binding correct?
private Path OrGateInput1()
{
...
-4
votes
0
answers
120
views
Binding textbox to an image in WPF
I'm creating an app for a clinic, they want to add the option of filling a prescription inside the app and printing it from there. I tried to just put some textboxes for the info, and put those over ...
0
votes
1
answer
103
views
How to handle empty string textbox bound to an int property validation error in WPF? Value "" could be not converted MVVM
Using MvvmCommunityToolkit and maybe is irrelevant, but I'm also using MaterialDesignForXAML UI library that sets default material design style for textbox if not is declared explictly.
I have a ...
0
votes
0
answers
36
views
Re-registering a Prism region when a pin tab in TabControl
I implemented a tab system using Prism regions and Syncfusion TabControlExt. Briefly about the system: MainTabControlViewModel is the main ViewModel that stores a collection of tabs. The tab objects ...
-1
votes
1
answer
77
views
Virtualization using VirtualizingStackPanel inside custom ControlTemplates
I'm tasked with implementing a custom DataGrid-like control in one of my projects.
This is due to many specific features it needs to have implemented, and also the large amounts of data that have to ...
0
votes
1
answer
104
views
Can't get PNG resource to show up in Visual Studio WPF designer
I created a simple program to replicate the issue.
I've created a custom control holding one generic string dependency property:
using System.Windows;
using System.Windows.Controls;
namespace Test
{
...
0
votes
0
answers
113
views
WPF: DropShadowEffect + Viewport2DVisual3D (Planerator/TiltEffect) causes deformation/offset during “tilt”
I’m trying to implement a “tilt” effect (a slight 3D tilt of an element on press/hover) in pure WPF, similar to UWP/WinUI. I’m using the classic approach with Viewport2DVisual3D (Greg Schechter’s ...
0
votes
1
answer
137
views
How to display rounded corners to the DataGrid in WPF?
I have the code to display rounded corners to the DataGrid. My problem is that it is not displaying rounded corners at the bottom of the DataGrid. How to make it rounded?
This is the code I am trying....
4
votes
4
answers
357
views
Task.Delay versus custom DispatcherTimer-based delay in WPF
I have a WPF project, and in some of the async event handlers in the WMain.xaml.cs I am using the Task.Delay method to suspend the execution of the handler. Example:
private async void Window_KeyDown(...
0
votes
0
answers
70
views
Drawing a color wheel with fxc shader in a WPF app
I want to achieve something like this with fxc shader in a WPF application.
So far, with the below hlsl (High-Level Shading Language) code, I managed to produced this picture:
The problem is that I ...
1
vote
2
answers
150
views
Always getting Exception thrown: 'System.Windows.Markup.XamlParseException' in PresentationFramework.dll
When I added the Icon="pack://siteoforigin:,,,/Resources/runtime-icon.ico" I get the following:
Exception thrown: 'System.Windows.Markup.XamlParseException' in
PresentationFramework.dll
...
0
votes
0
answers
72
views
DataGridCells not updating when Multibinding and MultiValueConverter change underlying value
I am currently working on an application for capacity planning. It shows three DataGrids:
grid one is for projects (displaying planned hours per project and per week),
grid two is for persons (...
0
votes
2
answers
124
views
How to share values that are split from one property across multiple controls in WPF & C#
I have a case where say I have one property that has a string which contains a separator (e.g. ':'). I have 3 text boxes and I would like to share each separated part value in each textbox and also ...
0
votes
2
answers
70
views
Use button to assign focus to an element inside nested control
I have a need to assign focus to an element inside a UserControl by clicking a button.
I haven't been able to come up with anything approaching a solution, I could probably have the button execute a ...
0
votes
2
answers
108
views
WPF ComboBox equivalent of VB6 ComboBox.Click event
I am migrating an old VB6 application to WPF (.NET 8).
In VB6, the ComboBox control has a Click event that fires only when the user actually selects an item from the drop down list. It does not fire ...
2
votes
1
answer
129
views
WPF ListView: AutoScroll to last item when new messages arrive (chat-like behavior)
I'm porting an application from MAUI to WPF, it's a chat application so I made this CollectionView in MAUI that contains all the messages from all the users inside a single chat and like a real chat ...
0
votes
1
answer
85
views
How can I Set Focus to an item property in a TreeView
Set Focus to an item property in a TreeView
The TreeView looks like:
<TreeView
Name="Tree"
BorderThickness="0"
ItemsSource="{Binding Items}">
<...
2
votes
1
answer
43
views
Xceed DockingManager dropdownbutton not showing content
I have an Xceed DockingManager that is bound to an observable collection of objects. The docking manager populates a dropdown button based on the number of objects within the observablecollection. ...
0
votes
1
answer
80
views
How to make animation when mouse over (ignoring clicks) in WPF template
I'm using WPF with DevExpress, and I'm creating a custom template for the DockLayoutManager tab headers. My goal is to have animations that play when (and only when) the mouse enters or exits the ...
2
votes
0
answers
128
views
In case of large number of items Context Menu is slowing down WPF application view rendering
I have following context menu defined as a part of the DataTemplate in xaml:
<DataTemplate DataType="{x:Type viewModel:OverviewAnnotationItemViewModel}">
<views:...
1
vote
1
answer
150
views
How can I resolve issue about BindingExpression in WPF C#?
I am working on a configuration editor and I was having issues binding ObservableCollection to combobox items in XAML.
My setup:
I am using Prism
I am also using MaterialDesignThemes in the project
...
0
votes
3
answers
71
views
Getting selected item of datagrid, which is an element of an observable collection
I've found lots of options for getting the selected item of a datagrid - easy. However, I have a property (DataGridViews) bound to an ItemsControl in xaml, which is an ObservableCollection. ...
0
votes
0
answers
113
views
How can I bind sets of columns to collection items?
I have this view model bound to the DataContext of a UserControl:
public SomeViewModel : BaseViewModel
{
public IEnumerable<Products> Products { get; set; }
...
}
public class Products
{...
0
votes
1
answer
88
views
WPF DataGrid with a DataGrid template column. Getting mouse wheel scroll to work
I have a datagrid. One of its columns is a template column containing a further "sub" data grid. This allows me to display hierarchical data and looks pretty good.
<DataGrid Name="...
-1
votes
4
answers
213
views
Is there a way to debug xaml file in Visual Studio?
I'm working on a WPF project targeting .NET 8. I have a breakpoint set on a line 127 in xaml file, but the debugger never hits it, even though I expect the corresponding UI logic to execute.
The ...
0
votes
1
answer
100
views
WPF TreeView how to align the control?
I want to build a web page–like effect that displays a directory tree with multi-level nesting. The left side should show the directory names, and the right side should display operation buttons ...
2
votes
0
answers
49
views
Can I impersonate a gMSA (managed service account) with LogonUser/WindowsIdentity to test folder write access? [duplicate]
I’m building a Windows installer (WPF, .NET 8) that needs to validate a chosen account (either a domain user or a gMSA) can write to several directories before installation. The simplest way I’ve ...
0
votes
0
answers
49
views
How do i disable the Slide Over Submenu on Hamburger Menu
In my application a hamburger menu by DevExpress is used. All user controls are collected in several groups. Icons of each group are displayed in the menu. When clicked on the menu expands inline ...
1
vote
1
answer
127
views
How to get the HWND handle of elements in .Net MAUI
I'm integrating the Dahua CCTV SDK (for live cameras) into a .NET MAUI application. I've successfully implemented this in WPF using HwndHost and in Avalonia using NativeControlHost, but I'm struggling ...