Questions tagged [wpf-controls]

WPF controls include UserControls, which are composite collections of other controls, and CustomControls, which are controls built with WPF styles and templates.

From Microsoft documentation:
Windows Presentation Foundation (WPF) ships with many of the common UI components that are used in almost every Windows application, such as Button, Label, TextBox, Menu, and ListBox. Historically, these objects have been referred to as controls. While the WPF SDK continues to use the term "control" to loosely mean any class that represents a visible object in an application, it is important to note that a class does not need to inherit from the Control class to have a visible presence. Classes that inherit from the Control class (AKA "Custom Controls") contain a ControlTemplate, which allows the consumer of a control to radically change the control's appearance without having to create a new subclass.

5697 questions
35
votes
1 answer

WPF Dynamic Layout with ItemsControl and Grid

I am creating a WPF form. One of the requirements is that it have a sector-based layout so that a control can be explicitly placed in one of the sectors/cells. I have created a tic-tac-toe example below to convey my problem: There are two types and…
Jason Williams
  • 1,283
  • 2
  • 11
  • 31
35
votes
9 answers

WPF ListBoxItem double-click?

The WPF ListBox doesn't have a DoubleClick event, at least not as far as I can tell. Is there a workaround for this issue that would let me double-click on an item to have an event handler do something with it? Thanks for your help.
David Veeneman
  • 18,912
  • 32
  • 122
  • 187
34
votes
2 answers

Make WPF textbox as cut, copy and paste restricted

How can I make a WPF textbox cut, copy and paste restricted?
Sauron
  • 16,668
  • 41
  • 122
  • 174
34
votes
1 answer

Conditional DataTemplate

Here is what I am trying to do. I have 2 Data Templates defined which both refer to a different user control.
user1175793
  • 343
  • 1
  • 3
  • 4
34
votes
6 answers

Slider On/Off Switch in WPF

I am looking for a WPF tutorial on creating a slide ON/OFF switch like on the iPhone. Here is an example (the "Send all traffic" option) https://secure-tunnel.com/support/software_setup/iphone/images/iphone_vpn_settings.jpg
Kevin Preston
  • 393
  • 2
  • 5
  • 7
34
votes
2 answers

What is the WPF equivalent for the FlowLayoutPanel?

I am working on a WPF application (a one note clone which is called "note your life") where you can dynamically assign Tags to an entry (just as in virtually any web 2.0 app these days). for this I had in my windows forms prototype a FlowLayoutPanel…
Sargola
  • 431
  • 1
  • 5
  • 8
32
votes
1 answer

How to display items in Canvas through Binding

I have list of items that I want to display in Canvas using data binding. ItemsToShowInCanvas = new ObservableCollection { new ItemDetail {Text = "ABC", Top = 10, Left = 200}, new ItemDetail {Text = "DEF", Top = 100,…
Souvik Basu
  • 3,069
  • 4
  • 28
  • 42
32
votes
3 answers

Understanding Uniform Grid control

I was just trying uniform grid, how it works. Code :
32
votes
8 answers

How to make WPF input control show virtual Keyboard when it got focus in touch screen

For our WPF application, when it runs on touch screen(Surface Pro .etc), the TextBox/PasswordBox control cannot show virtual keyboard when they get focused. Any good way to implement this feature in WPF? Updated: what we want to achieve finally is…
user1031200
32
votes
2 answers

How do I create a dashed border with rounded corners in WPF?

The Rectangle element has StrokeDashArray which allows it to be drawn with dashes, but it doesn't support rounded corners. The Border control supports nice thick lines with rounded corners, but will only draw solid lines. What's the best way to…
GraemeF
  • 11,327
  • 5
  • 52
  • 76
31
votes
4 answers

how use icon [Font-awesome] in WPF

I am new in WPF. I want to use Font-awesome Icon in textbox and button. but the icon is not bind with my textbox I install Font-awesome resource to my application. Let me know the way how can I use it Thank You, I really need it please help…
shivani
  • 980
  • 1
  • 8
  • 29
31
votes
3 answers

WPF CheckBox with "Button" appearance

I need a button-like control that can have a Checked property, so that when clicked it stays pressed. I had that functionality in WinForms, with the CheckBox control, setting the Appearance property to "Button". Can someone help me?
Nelson Reis
  • 4,780
  • 9
  • 43
  • 61
30
votes
3 answers

Align button content

I want the content of a wpf button to be left aligned I tried the following but the text is still centered inside the button.
30
votes
9 answers

How to display the current time and date in C#

How do you display the current date and time in a label in c#
ABCProgrammer
30
votes
8 answers

WPF: Cancel a user selection in a databound ListBox?

How do I cancel a user selection in a databound WPF ListBox? The source property is set correctly, but the ListBox selection is out of sync. I have an MVVM app that needs to cancel a user selection in a WPF ListBox if certain validation conditions…
David Veeneman
  • 18,912
  • 32
  • 122
  • 187