forked from Kinnara/ModernWpf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathListBoxPage.xaml
54 lines (53 loc) · 2.49 KB
/
ListBoxPage.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<ui:Page
x:Class="ModernWpf.SampleApp.ControlPages.ListBoxPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:sc="clr-namespace:SamplesCommon;assembly=SamplesCommon"
mc:Ignorable="d">
<ScrollViewer>
<ui:SimpleStackPanel Style="{StaticResource ControlPageContentPanelStyle}">
<sc:ControlExample HeaderText="A ListBox with items defined inline and its width set.">
<StackPanel HorizontalAlignment="Left">
<ListBox
x:Name="ListBox1"
Width="200">
<sys:String>Blue</sys:String>
<sys:String>Green</sys:String>
<sys:String>Red</sys:String>
<sys:String>Yellow</sys:String>
</ListBox>
<Rectangle
Fill="{Binding ElementName=ListBox1, Path=SelectedItem}"
Height="30"
Width="100"
Margin="0,10,0,0" />
</StackPanel>
</sc:ControlExample>
<sc:ControlExample
x:Name="Example2"
HeaderText="A ListBox with its ItemsSource and Height set."
HorizontalContentAlignment="Stretch">
<sc:ControlExample.Example>
<StackPanel>
<ListBox
x:Name="ListBox2"
ItemsSource="{Binding Fonts}"
DisplayMemberPath="Item1"
SelectedValuePath="Item2"
SelectedIndex="2"
Height="164" />
<TextBlock
x:Name="Control2Output"
Text="You can set the font used for this text."
FontFamily="{Binding ElementName=ListBox2, Path=SelectedValue}"
Style="{StaticResource OutputTextBlockStyle}" />
</StackPanel>
</sc:ControlExample.Example>
</sc:ControlExample>
</ui:SimpleStackPanel>
</ScrollViewer>
</ui:Page>