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
324
votes
4 answers

Difference between Visibility.Collapsed and Visibility.Hidden

What are differences between Visibility.Collapsed and Visibility.Hidden in WPF?
Sauron
  • 16,668
  • 41
  • 122
  • 174
294
votes
32 answers

How to bind to a PasswordBox in MVVM

I have come across a problem with binding to a PasswordBox. It seems it's a security risk but I am using the MVVM pattern so I wish to bypass this. I found some interesting code here (has anyone used this or something…
mark smith
  • 20,637
  • 47
  • 135
  • 187
271
votes
6 answers

Simple (I think) Horizontal Line in WPF?

Creating a relatively simple data entry form, and just want to separate certain sections with a horizontal line (not unlike an HR tag in HTML) that stretches the full length of the form. I have tried this:
Phil Sandler
  • 27,544
  • 21
  • 86
  • 147
254
votes
3 answers

What is The difference between ListBox and ListView

What is the difference between WPF's ListBox and ListView? I can not find any significant difference in their properties. Is there different typical use?
Rasto
  • 17,204
  • 47
  • 154
  • 245
250
votes
5 answers

ItemsControl with horizontal orientation

Do you know any controls inherited from the ItemsControl that have horizontal orientation of items?
user101375
  • 6,961
  • 9
  • 42
  • 43
174
votes
9 answers

Align items in a stack panel?

I was wondering if I can have 2 controls in a horizontal-oriented StackPanel so that the right item should be docked to the right side of the StackPanel. I tried the following but it didn't work:
Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
147
votes
3 answers

WPF: ItemsControl with scrollbar (ScrollViewer)

I followed this small "tutorial" on how to add a scrollbar to an ItemsControl, and it works in Designer view, but not when I compile and execute the program (only the first few items show up, and no scrollbar to view more - even when…
Xuntar
  • 2,260
  • 3
  • 21
  • 31
141
votes
11 answers

How do I make XAML DataGridColumns fill the entire DataGrid?

I am using DataGrids in XAML (not Silverlight) with resizable columns, the DataGrid will expand if the user resizes the screen. Currently if the widths of all the DataGrid columns are less than the width of the DataGrid I get an extra "column"…
Purplegoldfish
  • 5,268
  • 9
  • 39
  • 59
132
votes
6 answers

Formatting text in a TextBlock

How do I achieve formatting of a text inside a TextBlock control in my WPF application? e.g.: I would like to have certain words in bold, others in italic, and some in different colors, like this example: The reason behind my question is this…
Ash
  • 3,494
  • 12
  • 35
  • 42
126
votes
11 answers

RichTextBox (WPF) does not have string property "Text"

I am trying to set/get the text of my RichTextBox, but Text is not among list of its properties when I want to get test.Text... I am using code behind in C# (.net framework 3.5 SP1) RichTextBox test = new RichTextBox(); cannot have test.Text(?) Do…
paradisonoir
96
votes
4 answers

WPF StringFormat on Label Content

I want to format my string binding as Amount is X where X is a property bound to a label. I've seen many examples but the following doesn't work:
Everything Matters
  • 2,672
  • 4
  • 25
  • 42
95
votes
3 answers

How can I hide the header of a WPF ListView?

I want to be able to hide the header at the top of each grid column in a WPF ListView. This is the XAML for my ListView:
Ozplc
  • 1,091
  • 2
  • 10
  • 15
93
votes
2 answers

The default value type does not match the type of the property

I have this class public class Tooth { public string Id {get;set;} } And this custrom control public partial class ToothUI : UserControl { public ToothUI() { InitializeComponent(); } public Tooth Tooth { …
Juan Pablo Gomez
  • 5,203
  • 11
  • 55
  • 101
92
votes
7 answers

Link button in wpf

How can I make Button to look like LinkButton, and I don't want to use Hyperlink...!! Any suggestions
Prashant Cholachagudda
  • 13,012
  • 23
  • 97
  • 162
90
votes
18 answers

How to create/make rounded corner buttons in WPF?

I need to create a rounded corner glossy button in WPF. Can anyone please explain me what steps are needed?
xorpower
  • 17,975
  • 51
  • 129
  • 180
1
2 3
99 100