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.

165 lines
7.3 KiB

<!--*************************************************************************************
Toolkit for WPF
Copyright (C) 2007-2021 Xceed Software Inc.
This program is provided to you under the terms of the XCEED SOFTWARE, INC.
COMMUNITY LICENSE AGREEMENT (for non-commercial use) as published at
https://github.com/xceedsoftware/wpftoolkit/blob/master/license.md
For more features, controls, and fast professional support,
pick up the Plus Edition at https://xceed.com/xceed-toolkit-plus-for-wpf/
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
***********************************************************************************-->
<local:DemoView x:Class="Xceed.Wpf.Toolkit.LiveExplorer.Samples.Button.Views.DropDownSplitButtonView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Xceed.Wpf.Toolkit.LiveExplorer"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="DropDown and Split Buttons">
<local:DemoView.Description>
<Paragraph FontSize="14"
FontFamily="Segoe">
<Run>The DropDownButton control is a button that when clicked displays a drop down in which you can place any custom content within.</Run>
<LineBreak />
<LineBreak />
<Run>The SplitButton control is a button that can be clicked and also provides a drop down in which you can place any custom content within.</Run>
</Paragraph>
</local:DemoView.Description>
<local:DemoView.Resources>
<xctk:ColorToSolidColorBrushConverter x:Key="ColorToSolidColorBrushConverter" />
<ObjectDataProvider x:Key="DropDownPlacementMode"
MethodName="GetValues"
ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="PlacementMode" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</local:DemoView.Resources>
<Grid>
<StackPanel Margin="10">
<GroupBox Header="Features"
Margin="0,5,0,5">
<Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- 1st Column-->
<TextBlock Text="MaxDropDownHeight:"
VerticalAlignment="Center" />
<xctk:DoubleUpDown x:Name="maxDropDownHeight"
Grid.Column="1"
Width="60"
Value="500"
AllowInputSpecialValues="PositiveInfinity"
Minimum="0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="5" />
<TextBlock Text="DropDown Position: "
Grid.Row="1"
VerticalAlignment="Center" />
<ComboBox x:Name="dropDownPosition"
Grid.Column="1"
Grid.Row="1"
ItemsSource="{Binding Source={StaticResource DropDownPlacementMode}}"
SelectedIndex="2"
HorizontalAlignment="Left"
Width="110"
VerticalAlignment="Center"
Margin="5" />
<!-- 2nd Column-->
<TextBlock Text="DropDownContentBackground:"
VerticalAlignment="Center"
Grid.Column="2"/>
<xctk:ColorPicker x:Name="dropDownContentBackground"
Grid.Column="3"
Width="60"
SelectedColor="LightGray"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="5" />
</Grid>
</GroupBox>
<StackPanel>
<TextBlock Text="Usage:"
Style="{StaticResource Header}" />
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="DropDownButton Usage:"
Style="{StaticResource Header}" />
<xctk:DropDownButton x:Name="_dropDownButton"
Grid.Row="1"
Margin="10"
Width="150"
HorizontalAlignment="Left"
Content="Click Me"
MaxDropDownHeight="{Binding Value, ElementName=maxDropDownHeight}"
DropDownPosition="{Binding SelectedItem, ElementName=dropDownPosition}"
DropDownContentBackground="{Binding SelectedColor, ElementName=dropDownContentBackground, Converter={StaticResource ColorToSolidColorBrushConverter}}"
Click="DropDownButton_Click">
<xctk:DropDownButton.DropDownContent>
<StackPanel>
<xctk:ColorCanvas Margin="10"/>
<Button Click="Button_Click"
Margin="10">OK</Button>
</StackPanel>
</xctk:DropDownButton.DropDownContent>
</xctk:DropDownButton>
<TextBlock Text="SplitButton Usage:"
Grid.Column="1"
Style="{StaticResource Header}" />
<xctk:SplitButton x:Name="_splitButton"
Grid.Row="1"
Grid.Column="1"
Margin="10"
Width="150"
HorizontalAlignment="Left"
Content="Click Me"
MaxDropDownHeight="{Binding Value, ElementName=maxDropDownHeight}"
DropDownPosition="{Binding SelectedItem, ElementName=dropDownPosition}"
DropDownContentBackground="{Binding SelectedColor, ElementName=dropDownContentBackground, Converter={StaticResource ColorToSolidColorBrushConverter}}"
Click="SplitButton_Click">
<xctk:SplitButton.DropDownContent>
<StackPanel>
<xctk:ColorCanvas Margin="10"/>
<Button Click="Button_Click"
Margin="10">OK</Button>
</StackPanel>
</xctk:SplitButton.DropDownContent>
</xctk:SplitButton>
</Grid>
</StackPanel>
</StackPanel>
</Grid>
</local:DemoView>