170,044 questions
2
votes
0
answers
49
views
WPF InlineUIContainer displaying images incorrectly
I have encountered a problem with the way InlineUIContainer allocates size for an image when used in a TextBlock and I cannot find a way to work around it.
Here is a simple WPF application that ...
2
votes
1
answer
112
views
WPF DataGrid binding updating on focus change
I'm looking to make a simple software test plan that groups the test scenarios by category and lets me check them of while I go.
I found this example from Microsoft, the is basically exactly what I'm ...
0
votes
0
answers
111
views
ListBox poor performance when setting item height
I have a ListBox that I am using to display a large list of items. I want to have virtualisation enabled, but I also want to have non uniform item heights and pixel scrolling.
In the example below, ...
0
votes
0
answers
113
views
WPF-App needs UseWindowsForms after upgrade to .NET 10
I just upgraded my WPF app from .NET 8 to .NET 10 and everything worked fine.
But when I publish the application and run it on another computer, I get the following dispatcher unhandled exception:
...
1
vote
2
answers
104
views
How to get DataContext from PlacementTarget parent in ContextMenu WPF
I'm working on my WPF Application, my localization this is class in ViewModel. I tried to create a context-menu for ListBoxItem, and save both DataContext, ListBoxMenuItem and ListBox DataContext
<...
-2
votes
0
answers
82
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
141
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
112
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
93
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
vote
1
answer
105
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
83
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
39
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
55
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
26
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
127
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
98
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
30
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
122
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
82
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
71
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
125
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
134
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
135
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
197
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
95
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 ...
Advice
0
votes
2
replies
121
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()
{
...
0
votes
1
answer
109
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
40
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
79
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
106
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
116
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
140
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
360
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
71
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
151
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
74
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
125
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
109
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
130
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
88
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
132
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
176
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
114
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
102
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
223
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 ...