<
TextBlock
Text
=
"Example 1"
VerticalAlignment
"Center"
/> <
ComboBox
ItemsSource
"{Binding MyStringOptions}"
Grid.Column
"1"
SelectedItem
"{Binding SelectedOption1}"
Margin
"5"
"2"
"10,5,5,0"
/>
Grid.Row
"Example 2"
"{Binding MyClassOptions}"
"{Binding SelectedClass}"
DisplayMemberPath
"Name"
><
Run
"{Binding SelectedClass.Name}"
/><
" - "
"{Binding SelectedClass.Age}"
</
>
"Example 3"
SelectedValuePath
"Age"
SelectedValue
"{Binding SelectedAge}"
"Selected age: "
. . .
ItemTemplate
"{StaticResource Example4ItemTemplate}"
DataTemplate
x:Key
"Example4ItemTemplate"
StackPanel
Orientation
"Horizontal"
"{Binding Name}"
", Aged "
"{Binding Age}"
"{StaticResource Example9_XamlArray}"
<x:Array x:Key="Example9_XamlArray" Type="sys:String" xmlns:sys="clr-namespace:System;assembly=mscorlib"> <sys:String>Bear</sys:String> <sys:String>Bird</sys:String> <sys:String>Cat</sys:String> <sys:String>Cow</sys:String> <sys:String>Dog</sys:String> <sys:String>Elephant</sys:String> <sys:String>Fish</sys:String> <sys:String>Goat</sys:String> <sys:String>Hamster</sys:String></x:Array>
x:Array
"Example9_XamlArray"
Type
"sys:String"
xmlns:sys
"clr-namespace:System;assembly=mscorlib"
sys:String
>Bear</
>Bird</
>Cat</
>Cow</
>Dog</
>Elephant</
>Fish</
>Goat</
>Hamster</
"{Binding Source={StaticResource WorkmenData}}"
"@Name"
XmlDataProvider
"WorkmenData"
XPath
"Workmen/Man"
x:XData
Workmen
xmlns
""
Man
Name
"Bob"
"Charles"
"Harry"
"Mark"
"Nick"
"William"
"6"
"Model"
"{Binding Source={x:Static model:StaticData.MyCarsStatic}}"
CompositeCollection
"Example7_CompositeCollection"
CollectionContainer
Collection
"{Binding Source={StaticResource MyCarsCollection}}"
ListBoxItem
Background
"Yellow"
>Another ListBoxItem</
ComboBox.Resources
DataType
"Man"
"LightBlue"
"{Binding XPath=@Name}"
"{x:Type model:MyCar}"
"LightGreen"
"{Binding Model}"
DataGridTemplateColumn
Header
"Example 9"
DataGridTemplateColumn.CellTemplate
"{Binding PartIds, RelativeSource={RelativeSource AncestorType=Window}}"
"{Binding PartId, UpdateSourceTrigger=PropertyChanged}"
Foreground
"BlueViolet"
"{Binding PartId}"
DataGridTemplateColumn.CellEditingTemplate
DataGridComboBoxColumn
"Example 11"
SelectedItemBinding
DataGridComboBoxColumn.ElementStyle
Style
TargetType
"ComboBox"
Setter
Property
"ItemsSource"
Value
"{Binding Path=PartIds, RelativeSource={RelativeSource AncestorType=Window}}"
DataGridComboBoxColumn.EditingElementStyle
"{Binding CarParts, RelativeSource={RelativeSource AncestorType=Window}}"
"PartName"
"PartID"
Naomi N edited Revision 4. Comment: Formatting
Richard Mueller edited Revision 3. Comment: Added borders to code blocks
Richard Mueller edited Revision 2. Comment: Add border to code block
XAML guy edited Revision 1. Comment: tweak code line
Richard Mueller edited Original. Comment: Replaced RGB values with standard color names to restore colors