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.

89 lines
5.8 KiB

<!--*********************************************************************
Extended WPF Toolkit
Copyright (C) 2010-2012 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
This program can be provided to you by Xceed Software Inc. under a
proprietary commercial license agreement for use in non-Open Source
projects. The commercial version of Extended WPF Toolkit also includes
priority technical support, commercial updates, and many additional
useful WPF controls if you license Xceed Business Suite for WPF.
Visit http://xceed.com and follow @datagrid on Twitter.
********************************************************************-->
<sample:DemoView x:Class="Samples.Modules.Calculator.Views.CalculatorUpDownView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sample="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
Title="CalculatorUpDown"
xmlns:conv="clr-namespace:Samples.Modules.Calculator.Converters"
Description="The CalculatorUpDown provides a TextBox with button spinners that allow incrementing and decrementing numeric values by using the spinner buttons, keyboard up/down arrows, or mouse wheel. It also provides a Calculator dropdown which allows you to perform mathematical calculations.">
<sample:DemoView.Resources>
<conv:FormatStringToVisibilityConverter x:Key="formatStringToVisibilityConverter" />
</sample:DemoView.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<GroupBox Header="Features" Grid.Row="0" Margin="5">
<Grid Margin="5" HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="Enter Closes Calculator:" VerticalAlignment="Center" />
<CheckBox x:Name="_enterClosesCalculator" Grid.Column="1" VerticalAlignment="Center" Margin="5" />
<TextBlock Text="Watermark:" Grid.Row="1" VerticalAlignment="Center" />
<TextBox x:Name="_watermark" Grid.Row="1" Grid.Column="1" Width="150" Margin="5" Text="Enter Value" />
<TextBlock Text="FormatString:" Grid.Row="2" VerticalAlignment="Center" />
<ComboBox x:Name="_formatString" SelectedIndex="0" Grid.Row="2" Grid.Column="1" Width="150" Margin="5">
<ComboBoxItem Tag="">None</ComboBoxItem>
<ComboBoxItem Tag="C">Currency</ComboBoxItem>
<ComboBoxItem Tag="F">Fixed Point</ComboBoxItem>
<ComboBoxItem Tag="G">General</ComboBoxItem>
<ComboBoxItem Tag="N">Number</ComboBoxItem>
<ComboBoxItem Tag="P">Percent</ComboBoxItem>
</ComboBox>
<TextBlock Text="Precision: " Grid.Row="3" VerticalAlignment="Center" Visibility="{Binding SelectedItem.Tag, ElementName=_formatString, Converter={StaticResource formatStringToVisibilityConverter}}" />
<xctk:IntegerUpDown x:Name="_precision" Grid.Row="3" Grid.Column="1" Width="75" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5" Minimum="0" Value="2" Visibility="{Binding SelectedItem.Tag, ElementName=_formatString, Converter={StaticResource formatStringToVisibilityConverter}}" ToolTip="Gets/Sets the maximum number of digits displayed to the right of the decimal point." />
<TextBlock Grid.Column="2" Text="Increment:" VerticalAlignment="Center" Margin="20,0,0,0"/>
<TextBlock Grid.Column="2" Grid.Row="1" Text="Minimum:" VerticalAlignment="Center" Margin="20,0,0,0"/>
<TextBlock Grid.Column="2" Grid.Row="2" Text="Maximum:" VerticalAlignment="Center" Margin="20,0,0,0"/>
<xctk:IntegerUpDown Grid.Column="3" Name="_increment" Minimum="0" Value="1" VerticalAlignment="Center" Margin="5" Width="150" />
<xctk:IntegerUpDown Grid.Column="3" Grid.Row="1" Name="_minimum" Value="-100" VerticalAlignment="Center" Margin="5" Width="150" />
<xctk:IntegerUpDown Grid.Column="3" Grid.Row="2" Name="_maximum" Value="5000" VerticalAlignment="Center" Margin="5" Width="150" />
</Grid>
</GroupBox>
<StackPanel Grid.Row="1" Margin="10" HorizontalAlignment="Left">
<TextBlock Text="Usage:" Style="{StaticResource Header}" />
<xctk:CalculatorUpDown Margin="10" Width="250"
Increment="{Binding Value, ElementName=_increment}"
Maximum="{Binding Value, ElementName=_maximum}"
Minimum="{Binding Value, ElementName=_minimum}"
Precision="{Binding Value, ElementName=_precision}"
FormatString="{Binding SelectedItem.Tag, ElementName=_formatString}"
Watermark="{Binding Text, ElementName=_watermark}"
EnterClosesCalculator="{Binding IsChecked, ElementName=_enterClosesCalculator}"/>
</StackPanel>
</Grid>
</sample:DemoView>