Questions tagged [xaml]

Extensible Application Markup Language (XAML) is a declarative XML-based language used for initializing structured values and objects in various frameworks. When a question is about the usage of XAML with a specific framework a tag for the framework should also be provided e.g. [wpf] (Windows Presentation Foundation), [silverlight], [windows-phone], [windows-store-apps] (Windows 8 store apps), [win-universal-app], [xamarin.forms] or [workflow-foundation]

XAML, eXtensible Application Markup Language, is a markup language for declarative application programming (a way of representing object graphs in XML).

Its main use is for defining user interfaces in (Windows Presentation Foundation), , , store apps, and .

The last two utilize principles from Microsoft Design Language (MDL) (previously known as Metro or Modern UI), though it can also be used for other applications, notably (Windows Workflow Foundation) workflows.

References:

61979 questions
662
votes
15 answers

In WPF, what are the differences between the x:Name and Name attributes?

Sometimes it seems that the Name and x:Name attributes are interchangeable. So, what are the definitive differences between them, and when is it preferable to use one over the other? Are there any performance or memory implications to using them the…
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
657
votes
14 answers

How do I use WPF bindings with RelativeSource?

How do I use RelativeSource with WPF bindings and what are the different use-cases?
David Schmitt
  • 58,259
  • 26
  • 121
  • 165
524
votes
8 answers

What's the difference between StaticResource and DynamicResource in WPF?

When using resources such as brushes, templates and styles in WPF, they can be specified either as StaticResources or as a DynamicResource
Isak Savo
  • 34,957
  • 11
  • 60
  • 92
410
votes
33 answers

How do I get a TextBox to only accept numeric input in WPF?

I'm looking to accept digits and the decimal point, but no sign. I've looked at samples using the NumericUpDown control for Windows Forms, and this sample of a NumericUpDown custom control from Microsoft. But so far it seems like NumericUpDown…
Giffyguy
  • 20,378
  • 34
  • 97
  • 168
409
votes
5 answers

Difference between SelectedItem, SelectedValue and SelectedValuePath

What is the difference betweeen the following: SelectedItem SelectedValue SelectedValuePath All these dependency properties are defined in Selector class. I often confuse SelectedItem with SelectedValue , and SelectedValue with SelectedValuePath.…
Nawaz
  • 353,942
  • 115
  • 666
  • 851
406
votes
4 answers

How to get StackPanel's children to fill maximum space downward?

I simply want flowing text on the left, and a help box on the right. The help box should extend all the way to the bottom. If you take out the outer StackPanel below it works great. But for reasons of layout (I'm inserting UserControls dynamically)…
Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047
378
votes
6 answers

How to get a ListBox ItemTemplate to stretch horizontally the full width of the ListBox?

I want to have the ListItems to extend with their orange background the full width of the Listbox. Currently they are only as wide as the FirstName + LastName. I've set every element I can to: HorizontalAlignment="Stretch". I want the background of…
Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047
310
votes
13 answers

Newline in string attribute

How can I add a line break to text when it is being set as an attribute i.e.: Breaking it out into the exploded format isn't an option for my particular situation. What I need is some way to…
MojoFilter
  • 12,256
  • 14
  • 53
  • 61
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
270
votes
7 answers

ResourceDictionary in a separate assembly

I have resource dictionary files (MenuTemplate.xaml, ButtonTemplate.xaml, etc) that I want to use in multiple separate applications. I could add them to the applications' assemblies, but it's better if I compile these resources in one single…
Gus Cavalcanti
  • 10,527
  • 23
  • 71
  • 104
260
votes
20 answers

Any way to make a WPF textblock selectable?

How to allow TextBlock's text to be selectable? I tried to get it to work by displaying the text using a read-only TextBox styled to look like a textblock but this will not work in my case because a TextBox does not have inlines. In other words, how…
Alan Le
  • 8,683
  • 7
  • 36
  • 31
251
votes
4 answers

Properties order in Margin

If I have such string in XAML: Storyboard.TargetProperty="Margin" From="1,2,3,4" To="0,0,0,0" What is Top Bottom Right and Left? 1- right 2- top 3- left 4 - bottom Is that right?
Papa John
  • 3,764
  • 3
  • 26
  • 23
233
votes
24 answers

How to hide close button in WPF window?

I'm writing a modal dialog in WPF. How do I set a WPF window to not have a close button? I'd still like for its WindowState to have a normal title bar. I found ResizeMode, WindowState, and WindowStyle, but none of those properties allow me to hide…
Michael Hedgpeth
  • 7,732
  • 10
  • 47
  • 66
233
votes
10 answers

The calling thread must be STA, because many UI components require this

I am using http://www.codeproject.com/KB/IP/Facebook_API.aspx I am trying to call the XAML which is created using WPF. But it gives me an error: The calling thread must be STA, because many UI components require this. I don't know what to do. I am…
C..
  • 6,897
  • 10
  • 30
  • 37
215
votes
22 answers

How to bind an enum to a combobox control in WPF?

I am trying to find a simple example where the enums are shown as is. All examples I have seen tries to add nice looking display strings but I don't want that complexity. Basically I have a class that holds all the properties that I bind, by first…
Joan Venge
  • 315,713
  • 212
  • 479
  • 689
1
2 3
99 100