All the controls missing in WPF. Over 1 million downloads.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
5.3 KiB

<!--*************************************************************************************
Extended WPF Toolkit
Copyright (C) 2007-2015 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Public
License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
For more features, controls, and fast professional support,
pick up the Plus Edition at http://xceed.com/wpf_toolkit
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
***********************************************************************************-->
<local:DemoView x:Class="Xceed.Wpf.Toolkit.LiveExplorer.Samples.WatermarkComboBox.Views.WatermarkComboBoxView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:Xceed.Wpf.Toolkit.LiveExplorer"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
Title="WatermarkComboBox">
<local:DemoView.Description>
<Paragraph FontSize="14"
FontFamily="Segoe">
<Run>The WatermarkComboBox is a ComboBox with a fully customizable watermark.</Run>
</Paragraph>
</local:DemoView.Description>
<local:DemoView.Resources>
<DataTemplate x:Key="WatermarkComboBoxTemplate1">
<Grid>
<StackPanel Orientation="Horizontal">
<Image Source="..\Resources\PencilTool16.png" />
<TextBlock Text="{Binding}"
Foreground="Green"
FontFamily="Sans Serif"
FontWeight="Bold"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="4,0,0,0"/>
</StackPanel>
</Grid>
</DataTemplate>
<DataTemplate x:Key="WatermarkComboBoxTemplate2">
<Border BorderBrush="Green"
BorderThickness="1">
<TextBlock Text="{Binding}"
Foreground="Red"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
</DataTemplate>
</local:DemoView.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<GroupBox Header="Features"
Margin="5">
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="Watermark: "
VerticalAlignment="Center" />
<TextBox Grid.Column="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Margin="5"
ToolTip="Gets/Sets the watermark when there are no comboBoxItem selected and focus is not on WatermarkComboBox."
Text="{Binding Watermark, ElementName=_watermarkComboBox, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Text="WatermarkTemplate: "
Grid.Row="1"
VerticalAlignment="Center" />
<ComboBox Grid.Column="1"
Grid.Row="1"
Width="150"
Margin="5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
SelectedValue="{Binding WatermarkTemplate, ElementName=_watermarkComboBox}"
SelectedValuePath="Tag">
<ComboBoxItem Content="Default"
Tag="{x:Null}" />
<ComboBoxItem Content="Template 1"
Tag="{StaticResource WatermarkComboBoxTemplate1}" />
<ComboBoxItem Content="Template 2"
Tag="{StaticResource WatermarkComboBoxTemplate2}" />
</ComboBox>
</Grid>
</GroupBox>
<StackPanel Grid.Row="1"
Margin="10">
<TextBlock Text="Usage:"
Margin="10"
Style="{StaticResource Header}" />
<xctk:WatermarkComboBox x:Name="_watermarkComboBox"
Margin="10"
Width="350"
IsEditable="True"
Watermark="Choose a ComboBox Item..."
WatermarkTemplate="{x:Null}"
VerticalContentAlignment="Center">
<ComboBoxItem Content="Red" />
<ComboBoxItem Content="Green" />
<ComboBoxItem Content="Blue" />
<ComboBoxItem Content="Yellow" />
<ComboBoxItem Content="Black" />
</xctk:WatermarkComboBox>
</StackPanel>
</Grid>
</local:DemoView>