Questions tagged [wpf]

Windows Presentation Foundation, or WPF, is a subsystem for rendering user interfaces in Windows-based applications.

Windows Presentation Foundation (WPF, previously known as “Avalon”) is part of the Microsoft .NET Framework used to create rich client user experiences for Windows applications. It is also considered as the successor to

It features a diverse set of controls, layout options, 2D and 3D graphics, media and text handling and enables data binding and style-driven templates.

It uses a combination of XAML, an XML-based markup language, and any of the Common Language Runtime languages to define user interface elements. A fundamental aspect of WPF is to separate the user interface definition from the business logic, which enables developers and designers to work concurrently on a single project much more easily. It enables the users to build a loosely coupled application with the use of data bindings effectively. WPF also moves UI rendering off to the video hardware through the use of . Doing so allows computers to utilize their GPU, which frees the CPU to handle more of the logic-oriented tasks.

WPF runtime libraries are included in all versions of Windows, since Windows Vista and Windows Server 2008.

To learn more, visit the WPF portal on MSDN. See also the Wikipedia entry on WPF.

WPF employs XAML, an XML-based language, to define and link various UI elements. WPF applications can also be deployed as standalone desktop programs, or hosted as an embedded object in a website. WPF aims to unify a number of common user interface elements, such as 2D/3D rendering, fixed and adaptive documents, typography, vector graphics, runtime animation, and pre-rendered media. These elements can then be linked and manipulated based on various events, user interactions, and data bindings.

Microsoft has released six major WPF versions:

  • WPF 4.6 (July 2015)
  • WPF 4.5 (August 2012)
  • WPF 4 (April 2010)
  • WPF 3.5SP1 (Aug 2008)
  • WPF 3.5 (Nov 2007)
  • WPF 3.0 (Nov 2006)

In future, the WPF runtime libraries will be provided by Microsoft as packages known as "App Local" in order for updates to be released independently of .NET Framework releases.

Breaking Changes

On December, 2018 WPF, WinForms and WinUI frameworks became another part of open source community, as announced by Microsoft. WinForms and WinUI are already open, and WPF is starting with System.XAML, and more changes will be announced during the 2019.

Resources

Visual Studio Extensions for WPF Controls

Chat Room

168897 questions
31
votes
8 answers

WPF binding not updating the view

I have a textblock: ... Status ... codebehind: public StatusPage() { InitializeComponent(); …
szpic
  • 4,346
  • 15
  • 54
  • 85
31
votes
3 answers

How does Cocoa compare to Microsoft, Qt?

I have done a few months of development with Qt (built GUI programmatically only) and am now starting to work with Cocoa. I have to say, I love Cocoa. A lot of the things that seemed hard in Qt are easy with Cocoa. Obj-C seems to be far less complex…
bastibe
  • 16,551
  • 28
  • 95
  • 126
31
votes
8 answers

disable mouse wheel on itemscontrol in wpf

I have a usercontrol that has a scrollviewer, then a bunch of child controls like text boxes, radio buttons, and listboxes, etc inside of it. I can use the mouse wheel to scroll the parent scrollviewer until my mouse lands inside a listbox then,…
odyth
  • 4,324
  • 3
  • 37
  • 45
31
votes
4 answers

WPF animation: binding to the "To" attribute of storyboard animation

I'm trying to create a button that behaves similarly to the "slide" button on the iPhone. I have an animation that adjusts the position and width of the button, but I want these values to be based on the text used in the control. Currently,…
user264621
31
votes
3 answers

WPF - How do I get the MainWindow instance?

I have this in MainWindow.xaml.cs: public partial class MainWindow : Window { public double _frameCounter = 0;\; Very new to WPF and C#, but the below (MainWindow.xaml) appears to me to be where this class is being instantiated:
Larry Holze
  • 365
  • 1
  • 4
  • 7
31
votes
5 answers

Dynamically toggle visibility of WPF grid column from C# code

My problem is: I can't find out how to toggle the visibility of my WPF grid column. Assume following XAML markup:
sebi
  • 431
  • 1
  • 4
  • 9
31
votes
3 answers

Capture mouse clicks on WPF TextBox

I want to capture mouse clicks on a TextBox:
Robbert Dam
  • 4,027
  • 10
  • 39
  • 58
31
votes
6 answers

When should I use dependency properties in WPF?

When should I use dependency properties in WPF? They are static, so we save a lot on memory, compared to using .NET properties. Other gains of using dependency properties over .NET properties are: 1) no need to check thread access 2) prompt a…
user2381422
  • 5,645
  • 14
  • 42
  • 56
31
votes
2 answers

Using a StaticResource SolidColorBrush to define the Gradient Stop Colors

I am creating some wpf resource dictionaries with all the styles for an application! I have a few LinearGradientBrushes, where the color is set directly in the LinearGradientBrush reference as GradientStops. However, I want to have a predefined set…
code-zoop
  • 7,312
  • 8
  • 47
  • 56
31
votes
2 answers

Binding to viewmodel from inside a datatemplate

I have multiple videos displayed they are bound with a videocollection in Mainviewmodel. Everything works fine untill I try to bind the enter command to Mainviewmodel. I Don't know the syntax for this. As it stands the binding is set to Video and…
Jeroen
  • 881
  • 1
  • 7
  • 9
31
votes
5 answers

Cant drag and move a WPF Form

I design a WPF form with Window Style=None. So I Cannot see the drag bar in the form. How can I move the Form with WindowStyle=None Property?
Jawahar BABU
  • 1,055
  • 2
  • 9
  • 7
31
votes
3 answers

How does ItemContainerGenerator.ContainerFromItem work with a grouped list?

I have a ListBox which until recently was displaying a flat list of items. I was able to use myList.ItemContainerGenerator.ConainerFromItem(thing) to retrieve the ListBoxItem hosting "thing" in the list. This week I've modified the ListBox slightly…
Matt Hamilton
  • 200,371
  • 61
  • 386
  • 320
31
votes
2 answers

How to see design-time data-binding in XAML editor (it works in runtime)?

I data-binded version number to appear as follows: DataContext="{Binding RelativeSource={RelativeSource Self}}"> Version is:
Tar
  • 8,529
  • 9
  • 56
  • 127
31
votes
5 answers

My WPF Application cannot locate resource 'Mainwindow.xaml'

I have been working on a WPF application using vb.net and I've recently run into a problem. When I build my code, the build is successful but when it comes to running the code the System.IO.IOexception throws an exception "Cannot locate resource…
George
  • 411
  • 1
  • 5
  • 6
31
votes
4 answers

Why doesn't Visual Studio want me to add a new window to my WPF project?

Maybe a stupid question, but when I add item to a WPF project, Visual Studio only offers me UserControl, and not Window. Is this trying to encourage me to do MVVM, is my setup broken, or is there some other reason I haven't thought of?
Benjol
  • 63,995
  • 54
  • 186
  • 268
1 2 3
99
100