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
46
votes
5 answers

Is there a TimePicker control in WPF (.NET 4)?

Is there a TimePicker control in WPF (.NET 4)? I was hoping the DatePicker control had the ability to show either a data or a time or both, but it doesn't seem so. Either of these would fit the bill for me: Wednesday, February 8th, 2012 2:27…
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
46
votes
7 answers

How to stretch in width a WPF user control to its window?

I have a Window with my user control and I would like to make usercontrol width equals window width. How to do that? The user control is a horizontal menu and contains a grid with three columns:
Victor Rodrigues
  • 11,353
  • 23
  • 75
  • 107
46
votes
1 answer

How to get WPF Window to autosize to content and no more

I have a dialog containing 2 TextBlocks, a Progress Bar and a cancel Button. Here is the XAML:
Cleve
  • 1,273
  • 1
  • 13
  • 26
46
votes
4 answers

How to set the location of a WPF window?

I have a List View in which I have defined a custom cell as a user control. In the custom cell I given user hyperlink, I am showing a WPF dialog when user clicks on a hyperlink. I want WPF dialog comes just above the hyperlink.. Please let me know…
Ashish Ashu
  • 14,169
  • 37
  • 86
  • 117
45
votes
1 answer

Grid's SharedSizeGroup and * sizing

I have a user control, call it UserControl, that has a grid with the following column definitions:
Flack
  • 5,727
  • 14
  • 69
  • 104
45
votes
8 answers

Set superscript and subscript in formatted text in wpf

How can I set some text as subscript/superscript in FormattedText in WPF?
Firoz
  • 7,224
  • 10
  • 41
  • 56
44
votes
5 answers

How do I make a WPF button look like a link?

I want to use buttons in WPF that are styled like links. Microsoft does this (seemingly inconsistently) in its Windows dialog boxes. They look like blue text. And change color and underline when the mouse cursor hovers over. Example: I got it…
Zack Peterson
  • 56,055
  • 78
  • 209
  • 280
41
votes
1 answer

Enabling Scrollbar in WPF

I'm having a problem right now where my WPF application hides anything below the fold when the window is too small vertically. How can I use XAML to get a vertical scrollbar to appear for the entire app so the user can scroll to see the rest of the…
resopollution
  • 19,600
  • 10
  • 40
  • 49
41
votes
10 answers

How to automatically scroll ScrollViewer - only if the user did not change scroll position

I would like to create the following behaviour in a ScrollViewer that wraps ContentControl: When the ContentControl height grows , the ScrollViewer should automatically scroll to the end. This is easy to achive by using…
Elad
  • 19,079
  • 18
  • 62
  • 71
40
votes
16 answers

Get the item doubleclick event of listview

What do I need to do in order to reference the double click event for a listview control?
Sauron
  • 16,668
  • 41
  • 122
  • 174
38
votes
2 answers

Stop WPF ScrollViewer automatically scrolling to perceived content

The Application I am building an application which includes a range selector. This consists of two custom drawn Slider controls contained within one UserControl derived class. The range selector control is then contained inside a ScrollViewer which…
user989056
  • 1,275
  • 2
  • 15
  • 33
38
votes
6 answers

How to Programmatically show a WPF/C# Windows.Control.ToolTip?

There doesn't seem to be a .Show() kind of method for the Windows.Control.ToolTip, incl in ToolTipService.
MrGreggles
  • 6,113
  • 9
  • 42
  • 48
37
votes
2 answers

Gaps between items in my ListBox

When I create ListBox with horizontal items ordering for example like this:
Rasto
  • 17,204
  • 47
  • 154
  • 245
36
votes
4 answers

WPF - choose startup window based on some condition

When running my program by clicking Run or pressing Ctrl + F5, is it possible to open different windows based on some check condition? I.e if some condition is satisfied I wish to open a particular window, but if its not I want to open another…
sai sindhu
  • 1,155
  • 5
  • 20
  • 30
35
votes
4 answers

How to get a top object (Window or Page) in WPF?

Within my custom WPF control I want to get a containing Window or Page. Window.GetWindow() method works fine when control is in a windowed app but when it's in the XBAP app in a browser it returns browser window instead of the page. Is there any…
Alan Mendelevich
  • 3,591
  • 4
  • 32
  • 50