All Questions
364
questions
85
votes
4
answers
39k
views
What's the difference between InvokeAsync and BeginInvoke for WPF Dispatcher
I noticed in .NET 4.5 that the WPF Dispatcher had gotten a new set of methods to execute stuff on the Dispatcher's thread called InvokeAsync. Before, .NET 4.5 we had Invoke and BeginInvoke which ...
67
votes
4
answers
15k
views
WPF Programming Methodology
In my APP I'm using an API of a software that my tool is managing. I've DAL that contain 16 classes, 3 of them are singletons. I've some logic in the .cs files and XAML's off course.
My question is, ...
56
votes
1
answer
3k
views
Unit-Test project fails to build after installing .NET 4.5
I have a WPF solution in .NET 4.0 that includes a Unit Test project which tests the different commands used in the ViewModels. Everything was working fine, but then I installed .NET 4.5 and VS2012.
...
28
votes
4
answers
5k
views
Prevent scrolling when mouse enters WPF ComboBox dropdown
When a ComboBox has a large number of items, its dropdown will become scrollable. When the user invokes this dropdown, and moves the mouse cursor to enter the bounds of the dropdown from the bottom, ...
27
votes
2
answers
17k
views
How to profile WPF 4.5 UI performance?
I'm developing a .NET 4.5 WPF app and having UI rendering performance issues.
After some googling, I came across WPF Performance Suite page which describes exactly the tool I need - Visual Profiler. ...
26
votes
1
answer
12k
views
Is the CallerMemberName attribute in 4.5 "able to be faked"?
So .NET 4.5 introduces the CallerMemberNameAttribute, which seems like a godsend to anyone working with WPF and implementing INotifyPropertyChanged - my question is this: Is the attribute ...
23
votes
1
answer
18k
views
WPF Radial Progressbar/Meter (i.e. Battery Meter) [closed]
I'm working on an Unified fitness app for Windows 8.1 and Windows Phone 8.1. Ideally one of the core views would feature a daily progress meter. The problem is that I haven't been able to come up with ...
20
votes
3
answers
10k
views
WPF WindowChrome: Edges of maximized Window are out of the screen
I use WindowChrome to customize a Window. When I maximize the Window, then the edges are out of the screen. I use the following code to fix this:
<Window x:Class="WpfApplication1.MainWindow"
...
20
votes
1
answer
10k
views
Window style with WPF Ribbon from Microsoft doesn't match Windows 8 style
I'm using the release Version of Windows 8 and Visual Studio 2012 to create a WPF application with a Ribbon control. I choose the ribbon control that comes with WPF in .Net Framework 4.5.
My code to ...
19
votes
1
answer
52k
views
Programmatically add control to Grid RowDefition in WPF 4.5
I've been through this site (and many others) trying to figure out what is going on and why this does not work. I am running VS2012 and have created a WPF C# app (target .NET 4.5). I am new to WPF, ...
17
votes
2
answers
4k
views
Has Airspace Support Definitely Been Dropped in WPF 4.5?
As I write this question, 2 days after the beta of .NET 4.5 was released, the What's New in WPF 4.5 Version 4.5 Beta page on MSDN still lists "Integrating WPF with win32 Graphical User Interfaces" as ...
16
votes
5
answers
10k
views
WPF Maximized Window bigger than screen
When creating a WPF window with AllowsTransparency="True" WindowStyle="None" and maximizing it via this.WindowState = WindowState.Maximized; the Window gets bigger than my screen.
When setting ...
13
votes
3
answers
4k
views
Delay property on Binding from .Net 4.5 in .Net 4.0
How can I implement Delay property from .Net 4.5 (described here) on binding in .Net 4.0?
I know I cannot inherit from BindingBase as ProvideValue is sealed.
I could implement MarkupExtension but ...
12
votes
1
answer
1k
views
Did WPF 4.5 parent-child behavior change: we can now add a child to another parent without exception?
In .Net 4.0 the following code throws an InvalidOperationException with the message "Specified element is already the logical child of another element. Disconnect it first."
var parent = new System....
11
votes
5
answers
19k
views
InputBindings work only when focused
I have designed a reuseable usercontrol. It contains UserControl.InputBindings. It is quite simple as it only contains a label and a button (and new properties etc.)
When I use the control in my ...
11
votes
4
answers
5k
views
Overriding ListBoxItem background color when not in focus (.NET 4.5)
According to this, overriding the ControlBrushKey resource should change the background color of a ListBox selected item when it doesn't have focus. I created a simple example to disprove this:
<...
11
votes
3
answers
2k
views
Event when dragging over valid drop target outside of app?
I have a very simple method that writes a file locally but I only want to fire it if the user looks like they are going to drop outside of the app because firing it every time they start dragging ...
10
votes
4
answers
29k
views
Styling a WPF Button with Image+Text
In my C#/WPF/.NET 4.5 application I have buttons with images that I implemented in the following fashion:
<Button Style="{StaticResource BigButton}">
<StackPanel>
<Image Source="...
10
votes
2
answers
10k
views
WPF Tree view, how to change indention
My Treeview basically has "folder" nodes, and one level below items which do NOT contain other items.
Therefor the space for the expand / collapse icons is not required (on level 2). Can I give up ...
10
votes
1
answer
760
views
WPF Richtextbox Bindable in .net 4.5
So I'm trying to use David Veeneman's Bindable WPF RichTextBox here in my .net 4.5 project. After adding the control and the ValueConverter in my code I noticed only the the public object Convert() ...
8
votes
3
answers
27k
views
How can I create Setup package for wpf 4.5 application using some script
I need to create install-able setup via scripting for my WPF application. I don't know where to start and what is best way to do this. Please help.
8
votes
2
answers
2k
views
Taskbar icon disappears when WindowChrome is used on Windows 8.1
I have some problems with an own styled WPF Window on Windows 8.1. I wrote a simple transparent WPF Window with a WindowChrome for default windows drag behaviors:
<Window x:Class="WpfApplication1....
7
votes
2
answers
1k
views
WPF Controls - Should code behind be avoided at all costs?
I have a WPF project and need to create a control that is specific to the domain but will be reused in multiple views.
The control must display a decimal value in 3 parts, the integral part and the ...
7
votes
2
answers
6k
views
What version of Blend supports WPF 4.5, Portable Class Library?
I am setting up the project structure for a new greenfield application. Our initial release will only support a WPF client, but we want to eventually roll out Metro and Silverlight clients as well. ...
7
votes
0
answers
2k
views
Breakpoint A breakpoint has been reached. How should I investigate this issue further?
I am currently working on a WPF application that is currently in production and we have a case of two users having a crash at the application start that I still cannot explain.
The application shows ...
7
votes
0
answers
5k
views
Application exiting with an exit code of -1073740771
I have a WPF application, which sometimes is exiting with an exit code of -1073740771. The issue is not occurring in any pattern and it's varying from system to system. In some system the issue is ...
7
votes
3
answers
3k
views
WPF NotifyIcon Crash On First Run - The root Visual of a VisualTarget cannot have a parent
Update: Issue appears to be introduced with .NET 4.5.2. Problem does not occur with either 4.5.1 or 4.5.
I have a strange issue I am having difficulty debugging. We have a WPF application built on ...
6
votes
1
answer
7k
views
Async friendly DispatcherTimer wrapper/subclass
I have a DispatcherTimer running in my code that fire every 30 seconds to update system status from the server. The timer fires in the client even if I'm debugging my server code so if I've been ...
6
votes
5
answers
4k
views
Binding and Async Operations
I have created a Window with a TextBlock inside. I have bound the Text property and everything works fine.
BUT
When I change the bounded property while inside a Task then nothing works!!
Do you know ...
6
votes
3
answers
15k
views
How to create ZipArchive correctly?
i'm writing Desktop WPF application (.Net Framework 4.5) and one of tasks is to save multiple files to zip archive. I made 2 methods. First to create zip, second to read from it.
public static ...
5
votes
3
answers
8k
views
Creating a ToolTip that shows all Validation.Errors for a control using INotifyDataErrorInfo in WPF 4.5
I have multiple controls including a TextBox and a ComboBox and I would like all of them to display a ToolTip with all of the errors contained in the Validation.Errors collection. I would like them ...
5
votes
1
answer
9k
views
Ribbon feature using .Net 4.5
So I was looking for new features in .Net 4.5 and I found that ribbon is now native API for it. I tried a program in WPF using it by including "System.Windows.Controls.Ribbon.dll"
and followed the ...
5
votes
3
answers
36k
views
Entity Framework with SQLite Error: An error occurred while reading from the store provider's data reader
I'm using SQLite 1.0.89 with EF 5 .NET Framework 4.5 on VS2013 in a WPF application in C#.
The DB size is not big and the table that the program use contain max 1000 row.
using the program I found ...
5
votes
2
answers
3k
views
Is WPF Hardware-accelerated when Window AllowsTransparency = true?
I have been looking at making my own window frame in WPF, similar to Visual Studio. I have read that setting AllowsTransparency = true would force WPF to render in software-mode. This example is the ...
5
votes
1
answer
1k
views
Virtualizing Panel that doesn't crop items
So, it looks really silly to have a chrome-less collection if the items are getting cut/cropped at the end of the scroll region.
I want to create a virtualizing panel for collections (ItemsControl/...
5
votes
2
answers
2k
views
How can I print a collection of UserControls in WPF?
Say I have the following small UserControl:
<StackPanel>
<TextBlock Text="{Binding Title, StringFormat=Name: {0}}" FontWeight="Bold"/>
<Separator/>
<ItemsControl ...
5
votes
2
answers
1k
views
WeakEventManager & DependencyPropertyChangedEventArgs
I am wondering what might be the best way to use the WeakEventManager (4.5 is fine) together with Events offerring DependencyPropertyChangedEventArgs. These do not derive from EventArgs (for ...
5
votes
1
answer
3k
views
Odd XAML Error: '"System.Windows.StaticResourceExtension" cannot be applied'
I have the following XAML to provide a recent document menu like VS2012's FILE > Recent Documents menu
<MenuItem Header="_FILE">
...
<MenuItem Header="_Recent Studies"
...
5
votes
2
answers
6k
views
Data Binding Value not updating from other thread
I have a WPF Application where I have the following StepCount Property in my ViewModel, which implements INotifyPropertyChanged, and then I have it bound to a TextBox in my View.
public int StepCount
...
5
votes
2
answers
8k
views
Convert a list of key/value pairs to datatable
I'm working on a parser. It gets values from source text. It does not know beforehand how many or which values it will get, i.e. names of variables, their count etc. could vary greatly. Each section ...
4
votes
4
answers
5k
views
The type 'System.Windows.Input.ICommand' exists in both 'PresentationCore.dll' and 'System.dll'
I've got this error that I just can't figure out.
I'm using VS 2012 (VS11) on Windows 8 with .net4.5 and I get this error when compiling a project that worked with VS 2010 and .net4.0.
This is the ...
4
votes
1
answer
3k
views
Convert Key to VirtualKeyCode
In my C#/WPF/.NET 4.5 application I am trying to capture a key press via a KeyEventHandler, and later use the excellent Windows Input Simulator to emulate that key press (to map gesture, voice etc. ...
4
votes
1
answer
3k
views
Is INotifyDataErrorInfo broken for WPF 4.5 DataGrids
I have made a simple implementation of INotifyDataErrorInfo in a WPF 4.5 project. This is a new interface for WPF but has been available in Silverlight for some time.
I know that NET4.5 is still ...
4
votes
3
answers
5k
views
WPF Visibility Resource with Binding
I got a WPF Application using MVVM Light. In one View i got many Controls which are using the same visibility binding. Because i dont like to insert my long binding path to every control. I'd like to ...
4
votes
1
answer
987
views
Commands binding troubles on Windows 8 (Release Preview)
Recently I got chance to play a little bit with Windows 8 Release Preview (Build 8400 to be specific). My aim was to investigate bugs which appeared in our product (WPF application) only under Windows ...
4
votes
2
answers
2k
views
WPF: In an attached property, how to wait until visual tree loaded properly?
I have an Attached Property in a WPF app.
The code below is inside the OnLoad event, but it doesn't work unless I add a hacky 500 millisecond delay in.
Is there some way to avoid this delay, and ...
4
votes
1
answer
487
views
How to stop ValidatesOnNotifyDataErrors from being too active
In my application I am using “validatesonnotifydataerrors” along with “DataAnnotations” so that the user is warned if the field they are editing is empty or has the wrong data etc. The problem I have ...
4
votes
1
answer
790
views
RichTextBox input is very laggy
I've got a RichTextBox, with a very small amount of text in (less than 100 characters including line endings). I have one event (TextChanged with an empty body), no styles, and the window is pretty ...
3
votes
4
answers
741
views
How to bubble events from MenuItems
In this application I placed a Menu inside a Usercontrol.
<UserControl>
<Grid>
<Menu x:Name="mainMenu">
<MenuItem Header="File">
<...
3
votes
3
answers
982
views
Using static function binding in XAML
I have a XAML file, where i want to replace field names with variables so i can have translation support for more languages for my application.
The way i currently use translation in my application ...