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
2 answers

WPF Canvas, how to add children dynamically with MVVM code behind

Requirement: To draw one Bitmap Image and rectangle(s) based on the collection of points. The rectangle should exactly fit on the pixels location over the image. There is also some text need to be added inside the rectangle. The Image will be…
Sathya Ram
  • 581
  • 1
  • 7
  • 11
31
votes
2 answers

WithUrl() not found in Core 3 client

My .NET SignalR client code not working any more in Core 3 (WPF): string hubAddress = "https://localhost:44329/Hub"; HubConnection hub = new HubConnectionBuilder().WithUrl(hubAddress).Build(); // WithUrl not found MS document said it is…
David Tsui
  • 433
  • 1
  • 5
  • 8
31
votes
3 answers

Datagrid binding in WPF

I know this has been asked already but I have done almost everything what is suggested by developers.
alice7
  • 3,834
  • 14
  • 64
  • 93
31
votes
5 answers

Why is my WPF textbox "kinda" readonly?

I have a text box in WPF that is part of a datatemplate for a listbox. In that text box I can delete, backspace, spacebar, but I can NOT type in new words, letters or numbers. I CAN paste from notepad though. What am I missing here?
Russ
  • 12,312
  • 20
  • 59
  • 78
31
votes
6 answers

How to get MessageBox.Show() to pop up in the middle of my WPF application?

I have a 700w x 300h WPF application and can drag it anywhere on my large screen. When my application executes: MessageBox.Show("Sorry, this function is not yet implemented."); the mesage box appears in the middle of my screen, which may or may not…
Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047
31
votes
5 answers

DataGrid column width doesn't auto-update

When the value of Change updates, its column doesn't update to fit the new value. So the column stays too small and the value is…
user626528
  • 13,999
  • 30
  • 78
  • 146
31
votes
6 answers

WPF: How to bind a command to the ListBoxItem using MVVM?

I have just started learning MVVM. I've made the application from scratch by following this MVVM tutorial (I highly recommend it to all MVVM beginners out there). Basically, what I have created so far is a couple of text boxes where user adds his or…
Boris
  • 9,986
  • 34
  • 110
  • 147
31
votes
5 answers

Change color and font for some part of text in WPF C#

Is there a way to change color and font for some part of text which I want to put on TextBox or RichTextBox. I am using C# WPF. For example richTextBox.AppendText("Text1 " + word + " Text2 "); Variable word for example to be other color and font…
tanasi
  • 1,804
  • 6
  • 37
  • 53
31
votes
13 answers

Third party WPF controls: Devexpress vs Telerik

I would like to hear your opinion about the two control providers. To put it in a nutshell: I am building a classic LOB desktop application. The app will be created entirely in WPF. PRISM 4.0 will be used heavily. Whenever possible, I will try to…
Sebastjan
  • 142
  • 1
  • 5
  • 13
31
votes
4 answers

How to create a Circular Style ProgressBar

I need help on implementing a circular progress bar like this: How should I implement the Circle to fill by increasing Value property?
Jalal
  • 6,594
  • 9
  • 63
  • 100
31
votes
3 answers

WPF .NET Best way to trigger an event every minute

I have an app that needs to check a database table every minute. The table is indexed by the time of day and so the app needs to run this check every minute. What's the best of way of doing this? I can create a background worker thread but if I…
Simon Temlett
  • 2,397
  • 2
  • 17
  • 17
31
votes
8 answers

Progressbar foreground color

Does anybody know how to change the foreground color of a WPF-Progressbar. It always seems to be merged with green.
Morvader
  • 2,317
  • 3
  • 31
  • 44
31
votes
4 answers

Is there a way to comment out XAML that contains comments?

I am fairly new to WPF and using XAML. I get really frustrated that I can not select a chunk of XAML and comment it out in Visual Studio 2010 using the comment button in the toolbar if the highlighted section already includes some comments. Other…
tmoltzan
  • 371
  • 1
  • 3
  • 6
31
votes
5 answers

What is the WPF XAML Data Binding equivalent of String.Format?

Or, to be more clear, how can I format a block of text (in my case, to be included within a tooltip) such that some portions of the text come from bound values. In plain C# I would use: _toolTip.Text = string.Format("{1:#0}% up, {2:#0}% down", …
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
31
votes
8 answers

How to make the last column in WPF datagrid take all the left space, always?

Standard WPF 4 Datagrid. Let' say I have datagrid 200 pixels wide, and 2 columns. I would like the columns take always entire space, meaning if the user resizes the first column to 50 pixels, the last one would be 150. Initially I set width 100…
greenoldman
  • 16,895
  • 26
  • 119
  • 185