This commit is contained in:
martinivanoff 2016-08-11 16:28:13 +03:00
Родитель 543a834cee
Коммит 8f7de4e68e
49 изменённых файлов: 2385 добавлений и 0 удалений

Просмотреть файл

@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropDownWithHeaders_SL", "D
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomFiltering_SL", "CustomFiltering\CustomFiltering_SL.csproj", "{F4F9BD12-8502-4900-8382-CC1805028D42}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropDownWithAddNewItem_SL", "DropDownWithAddNewItem\DropDownWithAddNewItem_SL.csproj", "{F42DAEB5-B2A9-4E67-A7D8-A6196360BEEC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -63,6 +65,20 @@ Global
{F4F9BD12-8502-4900-8382-CC1805028D42}.ReleaseTrial.NoXaml|Any CPU.Build.0 = Release|Any CPU
{F4F9BD12-8502-4900-8382-CC1805028D42}.ReleaseTrial|Any CPU.ActiveCfg = Release|Any CPU
{F4F9BD12-8502-4900-8382-CC1805028D42}.ReleaseTrial|Any CPU.Build.0 = Release|Any CPU
{F42DAEB5-B2A9-4E67-A7D8-A6196360BEEC}.Debug.NoXaml|Any CPU.ActiveCfg = Debug|Any CPU
{F42DAEB5-B2A9-4E67-A7D8-A6196360BEEC}.Debug.NoXaml|Any CPU.Build.0 = Debug|Any CPU
{F42DAEB5-B2A9-4E67-A7D8-A6196360BEEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F42DAEB5-B2A9-4E67-A7D8-A6196360BEEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F42DAEB5-B2A9-4E67-A7D8-A6196360BEEC}.Release.NoXaml|Any CPU.ActiveCfg = Release|Any CPU
{F42DAEB5-B2A9-4E67-A7D8-A6196360BEEC}.Release.NoXaml|Any CPU.Build.0 = Release|Any CPU
{F42DAEB5-B2A9-4E67-A7D8-A6196360BEEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F42DAEB5-B2A9-4E67-A7D8-A6196360BEEC}.Release|Any CPU.Build.0 = Release|Any CPU
{F42DAEB5-B2A9-4E67-A7D8-A6196360BEEC}.ReleaseNoCA|Any CPU.ActiveCfg = Release|Any CPU
{F42DAEB5-B2A9-4E67-A7D8-A6196360BEEC}.ReleaseNoCA|Any CPU.Build.0 = Release|Any CPU
{F42DAEB5-B2A9-4E67-A7D8-A6196360BEEC}.ReleaseTrial.NoXaml|Any CPU.ActiveCfg = Release|Any CPU
{F42DAEB5-B2A9-4E67-A7D8-A6196360BEEC}.ReleaseTrial.NoXaml|Any CPU.Build.0 = Release|Any CPU
{F42DAEB5-B2A9-4E67-A7D8-A6196360BEEC}.ReleaseTrial|Any CPU.ActiveCfg = Release|Any CPU
{F42DAEB5-B2A9-4E67-A7D8-A6196360BEEC}.ReleaseTrial|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropDownWithHeaders_WPF", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomFiltering_WPF", "CustomFiltering\CustomFiltering_WPF.csproj", "{155895DA-923A-4FA3-BC41-AF20A7ACF204}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropDownWithAddNewItem_WPF", "DropDownWithAddNewItem\DropDownWithAddNewItem_WPF.csproj", "{A125E58E-B1B7-4202-8806-24091CB31855}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -147,6 +149,44 @@ Global
{155895DA-923A-4FA3-BC41-AF20A7ACF204}.ReleaseTrial451.NoXaml|Any CPU.Build.0 = Release|Any CPU
{155895DA-923A-4FA3-BC41-AF20A7ACF204}.ReleaseTrial451|Any CPU.ActiveCfg = Release|Any CPU
{155895DA-923A-4FA3-BC41-AF20A7ACF204}.ReleaseTrial451|Any CPU.Build.0 = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Debug.NoXaml|Any CPU.ActiveCfg = Debug|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Debug.NoXaml|Any CPU.Build.0 = Debug|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Debug45.NoXaml|Any CPU.ActiveCfg = Debug|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Debug45.NoXaml|Any CPU.Build.0 = Debug|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Debug45|Any CPU.ActiveCfg = Debug|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Debug45|Any CPU.Build.0 = Debug|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Debug451.NoXaml|Any CPU.ActiveCfg = Debug|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Debug451.NoXaml|Any CPU.Build.0 = Debug|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Debug451|Any CPU.ActiveCfg = Debug|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Debug451|Any CPU.Build.0 = Debug|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Release.NoXaml|Any CPU.ActiveCfg = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Release.NoXaml|Any CPU.Build.0 = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Release|Any CPU.Build.0 = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Release45.NoXaml|Any CPU.ActiveCfg = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Release45.NoXaml|Any CPU.Build.0 = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Release45|Any CPU.ActiveCfg = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Release45|Any CPU.Build.0 = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Release451.NoXaml|Any CPU.ActiveCfg = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Release451.NoXaml|Any CPU.Build.0 = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Release451|Any CPU.ActiveCfg = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.Release451|Any CPU.Build.0 = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.ReleaseNoCA|Any CPU.ActiveCfg = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.ReleaseNoCA|Any CPU.Build.0 = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.ReleaseTrial.NoXaml|Any CPU.ActiveCfg = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.ReleaseTrial.NoXaml|Any CPU.Build.0 = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.ReleaseTrial|Any CPU.ActiveCfg = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.ReleaseTrial|Any CPU.Build.0 = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.ReleaseTrial45.NoXaml|Any CPU.ActiveCfg = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.ReleaseTrial45.NoXaml|Any CPU.Build.0 = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.ReleaseTrial45|Any CPU.ActiveCfg = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.ReleaseTrial45|Any CPU.Build.0 = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.ReleaseTrial451.NoXaml|Any CPU.ActiveCfg = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.ReleaseTrial451.NoXaml|Any CPU.Build.0 = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.ReleaseTrial451|Any CPU.ActiveCfg = Release|Any CPU
{A125E58E-B1B7-4202-8806-24091CB31855}.ReleaseTrial451|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -0,0 +1,298 @@
<Application x:Class="DropDownWithAddNewItem.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:telerik1="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:telerikChromes="clr-namespace:Telerik.Windows.Controls.Chromes;assembly=Telerik.Windows.Controls"
xmlns:local="clr-namespace:DropDownWithAddNewItem"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Telerik.Windows.Themes.Office_Black;component/Themes/System.Windows.xaml" />
<ResourceDictionary Source="/Telerik.Windows.Themes.Office_Black;component/Themes/Telerik.Windows.Controls.xaml" />
<ResourceDictionary Source="/Telerik.Windows.Themes.Office_Black;component/Themes/Telerik.Windows.Controls.Input.xaml" />
</ResourceDictionary.MergedDictionaries>
<local:ViewModel x:Key="ViewModel" />
<ControlTemplate x:Key="CustomEditableComboBox" TargetType="telerik:RadComboBox">
<Grid x:Name="VisualRoot">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlOuterBorder_Disabled}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Opacity">
<LinearDoubleKeyFrame KeyTime="0:0:0.050" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0.050">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonChrome" Storyboard.TargetProperty="RenderEnabled">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<sys:Boolean>False</sys:Boolean>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation Duration="0" Storyboard.TargetName="PART_EditableTextBox" Storyboard.TargetProperty="Opacity" To="0.6"/>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconForeground_Disabled}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconBackground_Disabled}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ControlBackground_Disabled}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="Opacity">
<LinearDoubleKeyFrame KeyTime="0" Value="0.6"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Normal">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Opacity">
<LinearDoubleKeyFrame KeyTime="0:0:0.150" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0.150">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="MouseOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonChrome" Storyboard.TargetProperty="RenderActive">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<sys:Boolean>True</sys:Boolean>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Opacity">
<LinearDoubleKeyFrame KeyTime="0:0:0.115" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconForeground_MouseOver}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconBackground_MouseOver}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="DropDownOpen">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlOuterBorder_Pressed}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Opacity">
<LinearDoubleKeyFrame KeyTime="0:0:0.050" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0.050">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Opacity">
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconForeground_Pressed}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconBackground_Pressed}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonChrome" Storyboard.TargetProperty="RenderFocused">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<sys:Boolean>True</sys:Boolean>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="00:00:00.150">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Unfocused"/>
</VisualStateGroup>
<VisualStateGroup x:Name="WatermarkStates">
<VisualState x:Name="WatermarkVisible">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Watermark" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="WatermarkInvisible"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border x:Name="Background"
Grid.Column="0"
IsHitTestVisible="False"
Background="{StaticResource PickerBackground_Normal}"
CornerRadius="{StaticResource SplitButton_LeftPartCornerRadius}"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{StaticResource PickerBackground_Normal}"/>
<Border Grid.ColumnSpan="2" IsHitTestVisible="False" Background="{TemplateBinding Background}" CornerRadius="{StaticResource SplitButton_SpanCornerRadius}" Margin="1"/>
<Border x:Name="Border"
Grid.ColumnSpan="2"
IsHitTestVisible="False"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{StaticResource SplitButton_SpanCornerRadius}"/>
<Border x:Name="MouseOverVisual"
Grid.ColumnSpan="2"
IsHitTestVisible="False"
BorderBrush="{StaticResource ControlOuterBorder_MouseOver}"
BorderThickness="{TemplateBinding BorderThickness}"
Opacity="0"
Visibility="Collapsed"
CornerRadius="{StaticResource SplitButton_SpanCornerRadius}"/>
<TextBox x:Name="PART_EditableTextBox"
Grid.Column="0"
Margin="1 1 0 1"
Style="{StaticResource ComboBoxTextBoxStyle}"
Padding="{TemplateBinding Padding}"
IsReadOnly="{TemplateBinding IsReadOnly}"
VerticalAlignment="Stretch"
VerticalContentAlignment="Center"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}">
<TextBox.Template>
<ControlTemplate TargetType="TextBox">
<Grid>
<ScrollViewer
Padding="{TemplateBinding Padding}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
IsTabStop="False"
VerticalScrollBarVisibility="Auto"
x:Name="PART_ContentHost"
VerticalContentAlignment="Stretch"/>
</Grid>
</ControlTemplate>
</TextBox.Template>
</TextBox>
<Border x:Name="FocusVisual"
Visibility="Collapsed"
Grid.ColumnSpan="2"
IsHitTestVisible="False"
BorderBrush="{StaticResource ControlOuterBorder_Focused}"
CornerRadius="{StaticResource SplitButton_SpanCornerRadius}"
BorderThickness="{TemplateBinding BorderThickness}">
<Border BorderBrush="{StaticResource ControlInnerBorder_Focused}" CornerRadius="{StaticResource SplitButton_SpanInnerCornerRadius}" BorderThickness="{TemplateBinding BorderThickness}"/>
</Border>
<telerik1:RadToggleButton x:Name="PART_DropDownButton" Margin="0" Padding="0" Grid.Column="1" IsTabStop="False" ClickMode="Press">
<telerik1:RadToggleButton.Template>
<ControlTemplate TargetType="telerik1:RadToggleButton">
<ContentPresenter/>
</ControlTemplate>
</telerik1:RadToggleButton.Template>
<Grid>
<telerikChromes:ButtonChrome x:Name="ButtonChrome"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
RenderPressed="{TemplateBinding IsDropDownOpen}"
RenderMouseOver="{Binding IsMouseOver, ElementName=PART_DropDownButton}"
CornerRadius="{StaticResource SplitButton_RightPartCornerRadius}"
RenderEnabled="{TemplateBinding IsEnabled}"
RenderActive="{TemplateBinding IsMouseOver}"
RenderFocused="{TemplateBinding IsKeyboardFocusWithin}"/>
<ContentControl x:Name="DropDownIcon"
Grid.Column="1"
IsTabStop="False"
Foreground="{StaticResource ButtonIconForeground_Normal}"
Background="{StaticResource ButtonIconBackground_Normal}"
Template="{StaticResource ArrowTemplateEditableCombobox}"/>
</Grid>
</telerik1:RadToggleButton>
<TextBlock x:Name="Watermark"
Text="{TemplateBinding EmptyText}"
Opacity=".5"
IsHitTestVisible="False"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Margin="5 0 0 0"
Visibility="Collapsed"/>
<Popup x:Name="PART_Popup">
<Grid x:Name="PopupRoot">
<Border
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
MinWidth="{TemplateBinding MinDropDownWidth}"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
Background="{StaticResource PickerPopupBackground}"
CornerRadius="{StaticResource SplitButton_SpanCornerRadius}"
x:Name="PART_ResizeBorder">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<telerik1:RadButton x:Name="AddItemButton"
Grid.Row="0"
Margin="-1 -1 -1 0"
Content="Add new item"
IsEnabled="{Binding DataContext.IsAddingItemEnabled, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=telerik:RadComboBox}}"
Command="{Binding DataContext.AddNewItemCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=telerik:RadComboBox}}"/>
<ScrollViewer x:Name="PART_ScrollViewer"
Grid.Row="1"
Padding="0 1 0 0"
BorderThickness="0"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
Foreground="{TemplateBinding Foreground}"
CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}">
<ItemsPresenter/>
</ScrollViewer>
</Grid>
</Border>
</Grid>
</Popup>
</Grid>
</ControlTemplate>
<Style x:Key="CustomRadComboBoxStyle" TargetType="telerik:RadComboBox" BasedOn="{StaticResource RadComboBoxStyle}">
<Setter Property="EditableTemplate" Value="{StaticResource CustomEditableComboBox}"/>
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>

Просмотреть файл

@ -0,0 +1,11 @@
using System.Windows;
namespace DropDownWithAddNewItem
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

Просмотреть файл

@ -0,0 +1,336 @@
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:telerikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"
xmlns:telerik1="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:telerikChromes="clr-namespace:Telerik.Windows.Controls.Chromes;assembly=Telerik.Windows.Controls"
xmlns:local="clr-namespace:DropDownWithAddNewItem"
x:Class="DropDownWithAddNewItem.App"
>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Telerik.Windows.Themes.Office_Black;component/Themes/System.Windows.xaml" />
<ResourceDictionary Source="/Telerik.Windows.Themes.Office_Black;component/Themes/Telerik.Windows.Controls.xaml" />
<ResourceDictionary Source="/Telerik.Windows.Themes.Office_Black;component/Themes/Telerik.Windows.Controls.Input.xaml" />
</ResourceDictionary.MergedDictionaries>
<local:ViewModel x:Key="ViewModel" />
<ControlTemplate x:Key="CustomEditableComboBox" TargetType="telerikInput:RadComboBox">
<Grid x:Name="VisualRoot">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlOuterBorder_Disabled}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Opacity">
<LinearDoubleKeyFrame KeyTime="0:0:0.050" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0.050">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonChrome" Storyboard.TargetProperty="RenderEnabled">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<sys:Boolean>False</sys:Boolean>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation Duration="0" Storyboard.TargetName="PART_EditableTextBox" Storyboard.TargetProperty="Opacity" To="0.6"/>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconForeground_Disabled}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconBackground_Disabled}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ControlBackground_Disabled}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="Opacity">
<LinearDoubleKeyFrame KeyTime="0" Value="0.6"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Normal">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Opacity">
<LinearDoubleKeyFrame KeyTime="0:0:0.150" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0.150">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="MouseOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonChrome" Storyboard.TargetProperty="RenderActive">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<sys:Boolean>True</sys:Boolean>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Opacity">
<LinearDoubleKeyFrame KeyTime="0:0:0.115" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconForeground_MouseOver}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconBackground_MouseOver}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="DropDownOpen">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlOuterBorder_Pressed}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Opacity">
<LinearDoubleKeyFrame KeyTime="0:0:0.050" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0.050">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Opacity">
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconForeground_Pressed}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconBackground_Pressed}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonChrome" Storyboard.TargetProperty="RenderFocused">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<sys:Boolean>True</sys:Boolean>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="00:00:00.150">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Unfocused"/>
</VisualStateGroup>
<VisualStateGroup x:Name="ValidationStates">
<VisualState x:Name="Valid"/>
<VisualState x:Name="InvalidUnfocused">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationTooltip" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="InvalidFocused">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationTooltip" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0.1">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ValidationTooltip" Storyboard.TargetProperty="IsOpen">
<DiscreteObjectKeyFrame KeyTime="0:0:0.15">
<DiscreteObjectKeyFrame.Value>
<sys:Boolean>True</sys:Boolean>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="WatermarkStates">
<VisualState x:Name="WatermarkVisible">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Watermark" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="WatermarkInvisible"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border x:Name="Background"
Grid.Column="0"
IsHitTestVisible="False"
Background="{StaticResource PickerBackground_Normal}"
CornerRadius="{StaticResource SplitButton_LeftPartCornerRadius}"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{StaticResource PickerBackground_Normal}"/>
<Border Grid.ColumnSpan="2" IsHitTestVisible="False" Background="{TemplateBinding Background}" CornerRadius="{StaticResource SplitButton_SpanCornerRadius}" Margin="1"/>
<Border x:Name="Border"
Grid.ColumnSpan="2"
IsHitTestVisible="False"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{StaticResource SplitButton_SpanCornerRadius}"/>
<Border x:Name="MouseOverVisual"
Grid.ColumnSpan="2"
IsHitTestVisible="False"
BorderBrush="{StaticResource ControlOuterBorder_MouseOver}"
BorderThickness="{TemplateBinding BorderThickness}"
Opacity="0"
Visibility="Collapsed"
CornerRadius="{StaticResource SplitButton_SpanCornerRadius}"/>
<TextBox x:Name="PART_EditableTextBox"
Grid.Column="0"
Margin="1 1 0 1"
Style="{StaticResource ComboBoxTextBoxStyle}"
Padding="{TemplateBinding Padding}"
IsReadOnly="{TemplateBinding IsReadOnly}"
VerticalAlignment="Stretch"
VerticalContentAlignment="Center"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}">
<TextBox.Template>
<ControlTemplate TargetType="TextBox">
<Grid>
<ScrollViewer
Padding="{TemplateBinding Padding}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
IsTabStop="False"
VerticalScrollBarVisibility="Auto"
VerticalContentAlignment="Center"
VerticalAlignment="Stretch"
x:Name="ContentElement"/>
</Grid>
</ControlTemplate>
</TextBox.Template>
</TextBox>
<Border x:Name="FocusVisual"
Visibility="Collapsed"
Grid.ColumnSpan="2"
IsHitTestVisible="False"
BorderBrush="{StaticResource ControlOuterBorder_Focused}"
CornerRadius="{StaticResource SplitButton_SpanCornerRadius}"
BorderThickness="{TemplateBinding BorderThickness}">
<Border BorderBrush="{StaticResource ControlInnerBorder_Focused}" CornerRadius="{StaticResource SplitButton_SpanInnerCornerRadius}" BorderThickness="{TemplateBinding BorderThickness}"/>
</Border>
<telerik1:RadToggleButton x:Name="PART_DropDownButton" Margin="0" Padding="0" Grid.Column="1" IsTabStop="False" ClickMode="Press">
<telerik1:RadToggleButton.Template>
<ControlTemplate TargetType="telerik1:RadToggleButton">
<ContentPresenter/>
</ControlTemplate>
</telerik1:RadToggleButton.Template>
<Grid>
<telerikChromes:ButtonChrome x:Name="ButtonChrome"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
RenderPressed="{TemplateBinding IsDropDownOpen}"
RenderMouseOver="{Binding IsMouseOver, ElementName=PART_DropDownButton}"
CornerRadius="{StaticResource SplitButton_RightPartCornerRadius}"
RenderFocused="{TemplateBinding IsFocused}"/>
<ContentControl x:Name="DropDownIcon"
Grid.Column="1"
IsTabStop="False"
Foreground="{StaticResource ButtonIconForeground_Normal}"
Background="{StaticResource ButtonIconBackground_Normal}"
Template="{StaticResource ArrowTemplateEditableCombobox}"/>
</Grid>
</telerik1:RadToggleButton>
<TextBlock x:Name="Watermark"
Text="{TemplateBinding EmptyText}"
Opacity=".5"
IsHitTestVisible="False"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Margin="5 0 0 0"
Visibility="Collapsed"/>
<telerikChromes:ValidationTooltip x:Name="ValidationTooltip"
Grid.ColumnSpan="2"
Visibility="Collapsed"
TooltipPlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
TooltipContent="{Binding Path=(Validation.Errors), RelativeSource={RelativeSource TemplatedParent}}"/>
<Popup x:Name="PART_Popup">
<Grid x:Name="PopupRoot">
<telerikChromes:ShadowChrome Margin="0 0 0 3"/>
<Border
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
MinWidth="{TemplateBinding MinDropDownWidth}"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
Background="{StaticResource PickerPopupBackground}"
CornerRadius="{StaticResource SplitButton_SpanCornerRadius}"
x:Name="PART_ResizeBorder"
Margin="0 0 0 3">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<telerik1:RadButton x:Name="AddItemButton"
Grid.Row="0"
Margin="-1 -1 -1 0"
Content="Add new item"
IsEnabled="{Binding IsAddingItemEnabled, Source={StaticResource ViewModel}}"
Command="{Binding AddNewItemCommand, Source={StaticResource ViewModel}}"/>
<ScrollViewer x:Name="PART_ScrollViewer"
Grid.Row="1"
Padding="0 1 0 0"
BorderThickness="0"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
Foreground="{TemplateBinding Foreground}"
telerik1:ScrollViewerExtensions.EnableMouseWheel="True">
<ItemsPresenter/>
</ScrollViewer>
</Grid>
</Border>
</Grid>
</Popup>
</Grid>
</ControlTemplate>
<Style x:Key="CustomRadComboBoxStyle" TargetType="telerik:RadComboBox" BasedOn="{StaticResource RadComboBoxStyle}">
<Setter Property="EditableTemplate" Value="{StaticResource CustomEditableComboBox}"/>
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>

Просмотреть файл

@ -0,0 +1,59 @@
using System;
using System.Windows;
namespace DropDownWithAddNewItem
{
public partial class App : Application
{
public App()
{
this.Startup += this.Application_Startup;
this.Exit += this.Application_Exit;
this.UnhandledException += this.Application_UnhandledException;
InitializeComponent();
}
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = new MainPage();
}
private void Application_Exit(object sender, EventArgs e)
{
}
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
// If the app is running outside of the debugger then report the exception using
// the browser's exception mechanism. On IE this will display it a yellow alert
// icon in the status bar and Firefox will display a script error.
if (!System.Diagnostics.Debugger.IsAttached)
{
// NOTE: This will allow the application to continue running after an exception has been thrown
// but not handled.
// For production applications this error handling should be replaced with something that will
// report the error to the website and stop the application.
e.Handled = true;
Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
}
}
private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
{
try
{
string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
}
catch (Exception)
{
}
}
}
}

Просмотреть файл

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F42DAEB5-B2A9-4E67-A7D8-A6196360BEEC}</ProjectGuid>
<ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DropDownWithAddNewItem</RootNamespace>
<AssemblyName>DropDownWithAddNewItem</AssemblyName>
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<SilverlightApplication>true</SilverlightApplication>
<SupportedCultures>
</SupportedCultures>
<XapOutputs>true</XapOutputs>
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
<XapFilename>DropDownWithAddNewItem.xap</XapFilename>
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
<SilverlightAppEntry>DropDownWithAddNewItem.App</SilverlightAppEntry>
<TestPageFileName>DropDownWithAddNewItemTestPage.html</TestPageFileName>
<CreateTestPage>true</CreateTestPage>
<ValidateXaml>true</ValidateXaml>
<EnableOutOfBrowser>false</EnableOutOfBrowser>
<OutOfBrowserSettingsFile>Properties\OutOfBrowserSettings.xml</OutOfBrowserSettingsFile>
<UsePlatformExtensions>false</UsePlatformExtensions>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
<LinkedServerProject>
</LinkedServerProject>
</PropertyGroup>
<!-- This property group is only here to support building this project using the
MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs
to set the TargetFrameworkVersion to v3.5 -->
<PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'">
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Bin\Debug</OutputPath>
<DefineConstants>DEBUG;TRACE;SILVERLIGHT</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Bin\Release</OutputPath>
<DefineConstants>TRACE;SILVERLIGHT</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System.Windows" />
<Reference Include="system" />
<Reference Include="System.Core">
<HintPath>$(TargetFrameworkDirectory)System.Core.dll</HintPath>
</Reference>
<Reference Include="System.Net" />
<Reference Include="System.Xml" />
<Reference Include="System.Windows.Browser" />
<Reference Include="Telerik.Windows.Controls">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKSLDIR)\Binaries.NoXaml\Silverlight\Telerik.Windows.Controls.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Input">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKSLDIR)\Binaries.NoXaml\Silverlight\Telerik.Windows.Controls.Input.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Themes.Office_Black">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKSLDIR)\Binaries.NoXaml\Silverlight\Telerik.Windows.Themes.Office_Black.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="App_SL.xaml.cs">
<DependentUpon>App_SL.xaml</DependentUpon>
</Compile>
<Compile Include="Example.xaml.cs">
<DependentUpon>Example.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ViewModel.cs" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App_SL.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
<Page Include="Example.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MainPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<None Include="Properties\AppManifest.xml" />
<None Include="Readme.md" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
<SilverlightProjectProperties />
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>

Просмотреть файл

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A125E58E-B1B7-4202-8806-24091CB31855}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DropDownWithAddNewItem</RootNamespace>
<AssemblyName>DropDownWithAddNewItem</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>DropDownWithAddNewItem.App</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="Telerik.Windows.Controls">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Controls.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Input">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Controls.Input.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Themes.Office_Black">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries.NoXaml\WPF40\Telerik.Windows.Themes.Office_Black.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Example.xaml.cs">
<DependentUpon>Example.xaml</DependentUpon>
</Compile>
<Compile Include="ViewModel.cs" />
<Page Include="Example.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
<None Include="Readme.md" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -0,0 +1,22 @@
<UserControl x:Class="DropDownWithAddNewItem.Example"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
DataContext="{StaticResource ViewModel}">
<StackPanel>
<TextBlock Text="This example demonstrates how to display AddNewItem button inside dropdown of an editable ComboBox. If the user enters a value that is not available in the dropdown, he could add it to the Items collection through this button."
TextWrapping="Wrap"
Margin="10" />
<StackPanel Margin="10">
<telerik:RadComboBox ItemsSource="{Binding Countries}"
Style="{StaticResource CustomRadComboBoxStyle}"
Text="{Binding CurrentText, Mode=TwoWay}"
SelectedIndex="{Binding SelectedIndex, Mode=TwoWay}"
Width="200" IsEditable="True" StaysOpenOnEdit="True" />
</StackPanel>
</StackPanel>
</UserControl>

Просмотреть файл

@ -0,0 +1,15 @@
using System.Windows.Controls;
namespace DropDownWithAddNewItem
{
/// <summary>
/// Interaction logic for Example.xaml
/// </summary>
public partial class Example : UserControl
{
public Example()
{
InitializeComponent();
}
}
}

Просмотреть файл

@ -0,0 +1,13 @@
<UserControl x:Class="DropDownWithAddNewItem.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DropDownWithAddNewItem"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<local:Example />
</Grid>
</UserControl>

Просмотреть файл

@ -0,0 +1,12 @@
using System.Windows.Controls;
namespace DropDownWithAddNewItem
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
}
}

Просмотреть файл

@ -0,0 +1,9 @@
<Window x:Class="DropDownWithAddNewItem.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:DropDownWithAddNewItem"
Title="MainWindow" Height="350" Width="525">
<Grid>
<local:Example />
</Grid>
</Window>

Просмотреть файл

@ -0,0 +1,15 @@
using System.Windows;
namespace DropDownWithAddNewItem
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

Просмотреть файл

@ -0,0 +1,6 @@
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Deployment.Parts>
</Deployment.Parts>
</Deployment>

Просмотреть файл

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DropDownWithAddNewItem")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DropDownWithAddNewItem")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f42daeb5-b2a9-4e67-a7d8-a6196360beec")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

63
ComboBox/DropDownWithAddNewItem/Properties/Resources.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DropDownWithAddNewItem.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DropDownWithAddNewItem.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

Просмотреть файл

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

26
ComboBox/DropDownWithAddNewItem/Properties/Settings.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DropDownWithAddNewItem.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Просмотреть файл

@ -0,0 +1,5 @@
#DropDown with AddNewItem button##
This example demonstrates how to display AddNewItem button inside dropdown of an editable ComboBox. If the user enters a value that is not available in the dropdown list, he could add it to the Items collection through this button.
<keywords:button, editable, combobox, template>

Просмотреть файл

@ -0,0 +1,88 @@
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Input;
using Telerik.Windows.Controls;
namespace DropDownWithAddNewItem
{
public class ViewModel : ViewModelBase
{
private bool _isAddingItemEnabled = false;
private string _currentText;
private int _selectedIndex = -1;
public ViewModel()
{
this.Countries = new ObservableCollection<string>()
{
"Germany",
"England",
"Belgium",
"Spain",
"Bulgaria",
"Argentina",
"Canada"
};
this.AddNewItemCommand = new DelegateCommand(AddNewItemCommandExecuted);
}
public ICommand AddNewItemCommand { get; set; }
public ObservableCollection<string> Countries { get; set; }
public bool IsAddingItemEnabled
{
get { return this._isAddingItemEnabled; }
set
{
if( this._isAddingItemEnabled != value)
{
this._isAddingItemEnabled = value;
this.OnPropertyChanged("IsAddingItemEnabled");
}
}
}
public string CurrentText
{
get { return this._currentText; }
set
{
if (this._currentText != value)
{
this._currentText = value;
if (this._currentText.Count() > 0 && this.SelectedIndex == -1)
{
this.IsAddingItemEnabled = true;
}
else this.IsAddingItemEnabled = false;
}
}
}
public int SelectedIndex
{
get { return this._selectedIndex; }
set
{
if (this._selectedIndex != value)
{
this._selectedIndex = value;
}
}
}
protected void AddNewItemCommandExecuted(object param)
{
this.Countries.Add(this.CurrentText);
}
}
}

Просмотреть файл

@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DifferentlyColoredUnfocused
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SelectedItemsSource_SL", "SelectedItemsSource\SelectedItemsSource_SL.csproj", "{8F439F16-3942-4F6E-938D-9AE874FBE2F2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShuttleControl_SL", "ShuttleControl\ShuttleControl_SL.csproj", "{13406823-BFDC-4EE1-8164-B6FDE684872B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -64,6 +66,10 @@ Global
{8F439F16-3942-4F6E-938D-9AE874FBE2F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8F439F16-3942-4F6E-938D-9AE874FBE2F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8F439F16-3942-4F6E-938D-9AE874FBE2F2}.Release|Any CPU.Build.0 = Release|Any CPU
{13406823-BFDC-4EE1-8164-B6FDE684872B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{13406823-BFDC-4EE1-8164-B6FDE684872B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{13406823-BFDC-4EE1-8164-B6FDE684872B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{13406823-BFDC-4EE1-8164-B6FDE684872B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DifferentlyColoredUnfocused
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SelectedItemsSource_WPF", "SelectedItemsSource\SelectedItemsSource_WPF.csproj", "{E0C171E0-6060-491A-81BA-F8020D4504DD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShuttleControl_WPF", "ShuttleControl\ShuttleControl_WPF.csproj", "{B1209742-ECB7-459D-964B-56D0C3B56FD9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -64,6 +66,10 @@ Global
{E0C171E0-6060-491A-81BA-F8020D4504DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E0C171E0-6060-491A-81BA-F8020D4504DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E0C171E0-6060-491A-81BA-F8020D4504DD}.Release|Any CPU.Build.0 = Release|Any CPU
{B1209742-ECB7-459D-964B-56D0C3B56FD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1209742-ECB7-459D-964B-56D0C3B56FD9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1209742-ECB7-459D-964B-56D0C3B56FD9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1209742-ECB7-459D-964B-56D0C3B56FD9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -0,0 +1,16 @@
namespace ShuttleControl
{
public class Agency
{
public Agency(string name, string phone, string zip)
{
Name = name;
Phone = phone;
Zip = zip;
}
public string Name { get; set; }
public string Phone { get; set; }
public string Zip { get; set; }
}
}

Просмотреть файл

@ -0,0 +1,8 @@
<Application x:Class="ShuttleControl.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

Просмотреть файл

@ -0,0 +1,11 @@
using System.Windows;
namespace ShuttleControl
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

Просмотреть файл

@ -0,0 +1,8 @@
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ShuttleControl.App"
>
<Application.Resources>
</Application.Resources>
</Application>

Просмотреть файл

@ -0,0 +1,59 @@
using System;
using System.Windows;
namespace ShuttleControl
{
public partial class App : Application
{
public App()
{
this.Startup += this.Application_Startup;
this.Exit += this.Application_Exit;
this.UnhandledException += this.Application_UnhandledException;
InitializeComponent();
}
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = new MainPage();
}
private void Application_Exit(object sender, EventArgs e)
{
}
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
// If the app is running outside of the debugger then report the exception using
// the browser's exception mechanism. On IE this will display it a yellow alert
// icon in the status bar and Firefox will display a script error.
if (!System.Diagnostics.Debugger.IsAttached)
{
// NOTE: This will allow the application to continue running after an exception has been thrown
// but not handled.
// For production applications this error handling should be replaced with something that will
// report the error to the website and stop the application.
e.Handled = true;
Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
}
}
private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
{
try
{
string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
}
catch (Exception)
{
}
}
}
}

Просмотреть файл

@ -0,0 +1,81 @@
<UserControl x:Class="ShuttleControl.Example"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<DataTemplate x:Key="ListBoxTemplate">
<StackPanel>
<TextBlock Text="{Binding Name}" FontWeight="Bold" />
<TextBlock Text="{Binding Phone}" />
</StackPanel>
</DataTemplate>
</UserControl.Resources>
<Grid Background="#E2E2E2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.ColumnSpan="3" Text="This example demonstrates how you can combine two RadListBox controls to implement a shuttle control. You can easily move/remove one or multiple select items from one to the other ListBox."
TextWrapping="Wrap" FontSize="13" FontStyle="Italic" Margin="3 1 3 5"/>
<StackPanel Grid.Row="1" Grid.Column="0" Margin="10">
<TextBlock Text="Database Objects" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="2" Margin="10">
<TextBlock Text="Selected Database Objects" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</StackPanel>
<Grid Grid.Column="0" Grid.Row="2" Background="White" Margin="10 0 10 10" >
<telerik:RadListBox Width="250" ItemsSource="{Binding AvailableItems}" SelectionMode="Multiple"
ItemTemplate="{StaticResource ListBoxTemplate}"
telerik:ListBoxSelectedItemsBehavior.SelectedItemsSource="{Binding SourceSelectedItems}" />
</Grid>
<StackPanel Grid.Column="1" Grid.Row="2" >
<StackPanel Margin="0 0 0 12">
<telerik:RadButton Command="{Binding AddCommand}" Width="90">
<Image Source="Images/MoveItems.png" Height="20"/>
</telerik:RadButton>
<TextBlock Text="Move" HorizontalAlignment="Center" FontSize="12"/>
</StackPanel>
<StackPanel Margin="0 0 0 12">
<telerik:RadButton Command="{Binding AddAllCommand}" Width="90">
<Image Source="Images/MoveAllItems.png" Height="20"/>
</telerik:RadButton>
<TextBlock Text="Move All" HorizontalAlignment="Center" FontSize="12"/>
</StackPanel>
<StackPanel Margin="0 0 0 12">
<telerik:RadButton Command="{Binding RemoveAllCommand}" Width="90">
<Image Source="Images/RemoveAllItems.png" Height="20"/>
</telerik:RadButton>
<TextBlock Text="Remove All" HorizontalAlignment="Center" FontSize="12"/>
</StackPanel>
<StackPanel Margin="0 0 0 12">
<telerik:RadButton Command="{Binding RemoveCommand}" Width="90">
<Image Source="Images/RemoveItems.png" Height="20"/>
</telerik:RadButton>
<TextBlock Text="Remove" HorizontalAlignment="Center" FontSize="12"/>
</StackPanel>
</StackPanel>
<Grid Grid.Column="2" Grid.Row="2" Background="White" Margin="10 0 10 10" >
<telerik:RadListBox Width="250" Grid.Column="2" ItemsSource="{Binding MovedItems}" SelectionMode="Multiple"
ItemTemplate="{StaticResource ListBoxTemplate}"
telerik:ListBoxSelectedItemsBehavior.SelectedItemsSource="{Binding TargetSelectedItems}" />
</Grid>
</Grid>
</UserControl>

Просмотреть файл

@ -0,0 +1,16 @@
using System.Windows.Controls;
namespace ShuttleControl
{
/// <summary>
/// Interaction logic for Example.xaml
/// </summary>
public partial class Example : UserControl
{
public Example()
{
InitializeComponent();
this.DataContext = new ViewModel();
}
}
}

Двоичные данные
ListBox/ShuttleControl/Images/MoveAllItems.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.8 KiB

Двоичные данные
ListBox/ShuttleControl/Images/MoveItems.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.8 KiB

Двоичные данные
ListBox/ShuttleControl/Images/RemoveAllItems.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.8 KiB

Двоичные данные
ListBox/ShuttleControl/Images/RemoveItems.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.8 KiB

Просмотреть файл

@ -0,0 +1,12 @@
<UserControl x:Class="ShuttleControl.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ShuttleControl"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid>
<local:Example Width="650" Height="400"/>
</Grid>
</UserControl>

Просмотреть файл

@ -0,0 +1,12 @@
using System.Windows.Controls;
namespace ShuttleControl
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
}
}

Просмотреть файл

@ -0,0 +1,9 @@
<Window x:Class="ShuttleControl.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ShuttleControl"
Title="MainWindow" Height="450" Width="650">
<Grid>
<local:Example />
</Grid>
</Window>

Просмотреть файл

@ -0,0 +1,15 @@
using System.Windows;
namespace ShuttleControl
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

Просмотреть файл

@ -0,0 +1,6 @@
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Deployment.Parts>
</Deployment.Parts>
</Deployment>

Просмотреть файл

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ShuttleControl_SL")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShuttleControl_SL")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("13406823-bfdc-4ee1-8164-b6fde684872b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

63
ListBox/ShuttleControl/Properties/Resources.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ShuttleControl.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ShuttleControl.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

Просмотреть файл

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

26
ListBox/ShuttleControl/Properties/Settings.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ShuttleControl.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Просмотреть файл

@ -0,0 +1,5 @@
##Shuttle Control##
This example demonstrates how you can combine two RadListBox controls to implement a shuttle control. You can easily move/remove one or multiple select items from one to the other ListBox.
<keywords: shuttlecontrol, databinding, mvvm>

Просмотреть файл

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{13406823-BFDC-4EE1-8164-B6FDE684872B}</ProjectGuid>
<ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ShuttleControl</RootNamespace>
<AssemblyName>ShuttleControl</AssemblyName>
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<SilverlightApplication>true</SilverlightApplication>
<SupportedCultures>
</SupportedCultures>
<XapOutputs>true</XapOutputs>
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
<XapFilename>ShuttleControl_SL.xap</XapFilename>
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
<SilverlightAppEntry>ShuttleControl.App</SilverlightAppEntry>
<TestPageFileName>ShuttleControl_SLTestPage.html</TestPageFileName>
<CreateTestPage>true</CreateTestPage>
<ValidateXaml>true</ValidateXaml>
<EnableOutOfBrowser>false</EnableOutOfBrowser>
<OutOfBrowserSettingsFile>Properties\OutOfBrowserSettings.xml</OutOfBrowserSettingsFile>
<UsePlatformExtensions>false</UsePlatformExtensions>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
<LinkedServerProject>
</LinkedServerProject>
</PropertyGroup>
<!-- This property group is only here to support building this project using the
MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs
to set the TargetFrameworkVersion to v3.5 -->
<PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'">
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Bin\Debug</OutputPath>
<DefineConstants>DEBUG;TRACE;SILVERLIGHT</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Bin\Release</OutputPath>
<DefineConstants>TRACE;SILVERLIGHT</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System.Windows" />
<Reference Include="system" />
<Reference Include="System.Core">
<HintPath>$(TargetFrameworkDirectory)System.Core.dll</HintPath>
</Reference>
<Reference Include="System.Net" />
<Reference Include="System.Xml" />
<Reference Include="System.Windows.Browser" />
<Reference Include="Telerik.Windows.Controls">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Navigation">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.Navigation.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Agency.cs" />
<Compile Include="App_SL.xaml.cs">
<DependentUpon>App_SL.xaml</DependentUpon>
</Compile>
<Compile Include="Example.xaml.cs">
<DependentUpon>Example.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ViewModel.cs" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App_SL.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
<Page Include="Example.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MainPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<None Include="Properties\AppManifest.xml" />
<None Include="Readme.md" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\MoveAllItems.png" />
<Resource Include="Images\MoveItems.png" />
<Resource Include="Images\RemoveAllItems.png" />
<Resource Include="Images\RemoveItems.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
<SilverlightProjectProperties />
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>

Просмотреть файл

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B1209742-ECB7-459D-964B-56D0C3B56FD9}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ShuttleControl</RootNamespace>
<AssemblyName>ShuttleControl</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>ShuttleControl.App</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="Telerik.Windows.Controls">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Navigation">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.Navigation.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Agency.cs" />
<Compile Include="Example.xaml.cs">
<DependentUpon>Example.xaml</DependentUpon>
</Compile>
<Compile Include="ViewModel.cs" />
<Page Include="Example.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
<None Include="Readme.md" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\MoveAllItems.png" />
<Resource Include="Images\MoveItems.png" />
<Resource Include="Images\RemoveAllItems.png" />
<Resource Include="Images\RemoveItems.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -0,0 +1,140 @@
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using Telerik.Windows.Controls;
namespace ShuttleControl
{
public class ViewModel
{
public ViewModel()
{
this.AvailableItems = new ObservableCollection<Agency>()
{
new Agency("Exotic Liquids", "(171) 555-2222", "EC1 4SD"),
new Agency("New Orleans Cajun Delights", "(100) 555-4822", "70117"),
new Agency("Grandma Kelly's Homestead", "(313) 555-5735", "48104"),
new Agency("Tokyo Traders", "(03) 3555-5011", "100"),
new Agency("Cooperativa de Quesos 'Las Cabras'", "(98) 598 76 54", "33007"),
new Agency("Mayumi's", "(06) 431-7877", "545"),
new Agency("Pavlova, Ltd.", "(03) 444-2343", "3058"),
new Agency("Specialty Biscuits, Ltd.", "(161) 555-4448", "M14 GSD"),
new Agency("PB Knäckebröd AB", "031-987 65 43", "S-345 67"),
new Agency("Refrescos Americanas LTDA", "(11) 555 4640", "5442")
};
this.MovedItems = new ObservableCollection<Agency>();
this.SourceSelectedItems = new ObservableCollection<Agency>();
this.TargetSelectedItems = new ObservableCollection<Agency>();
this.SourceSelectedItems.CollectionChanged += SourceSelectedItems_CollectionChanged;
this.TargetSelectedItems.CollectionChanged += TargetSelectedItems_CollectionChanged;
this.AvailableItems.CollectionChanged += AvailableItems_CollectionChanged;
this.MovedItems.CollectionChanged += MovedItems_CollectionChanged;
this.AddCommand = new DelegateCommand(this.AddCommandExecuted, this.CanAddCommandExecute);
this.RemoveCommand = new DelegateCommand(this.RemoveCommandExecuted, this.CanRemoveCommandExecute);
this.AddAllCommand = new DelegateCommand(this.AddAllCommandExecuted, this.CanAddAllCommandExecute);
this.RemoveAllCommand = new DelegateCommand(this.RemoveAllCommandExecuted, this.CanRemoveAllCommandExecute);
}
public ObservableCollection<Agency> AvailableItems { get; set; }
public ObservableCollection<Agency> MovedItems { get; set; }
public ObservableCollection<Agency> SourceSelectedItems { get; set; }
public ObservableCollection<Agency> TargetSelectedItems { get; set; }
public DelegateCommand AddCommand { get; set; }
public DelegateCommand RemoveCommand { get; set; }
public DelegateCommand AddAllCommand { get; set; }
public DelegateCommand RemoveAllCommand { get; set; }
protected bool CanAddCommandExecute(object param)
{
return this.SourceSelectedItems.Count > 0;
}
protected void AddCommandExecuted(object param)
{
this.TargetSelectedItems.Clear();
var sourceSelectedItemsCopy = new ObservableCollection<Agency>(this.SourceSelectedItems);
foreach (var item in sourceSelectedItemsCopy)
{
this.AvailableItems.Remove(item);
this.MovedItems.Add(item);
}
}
protected bool CanRemoveCommandExecute(object param)
{
return this.TargetSelectedItems.Count > 0;
}
protected void RemoveCommandExecuted(object param)
{
this.SourceSelectedItems.Clear();
var targetSelectedItemsCopy = new ObservableCollection<Agency>(this.TargetSelectedItems);
foreach (var item in targetSelectedItemsCopy)
{
this.MovedItems.Remove(item);
this.AvailableItems.Add(item);
}
}
protected bool CanAddAllCommandExecute(object param)
{
return this.AvailableItems.Count() > 0;
}
protected void AddAllCommandExecuted(object param)
{
var initialCount = this.AvailableItems.Count();
for (int i = 0; i < initialCount; i++)
{
var itemToRemove = this.AvailableItems.ElementAt(0);
this.AvailableItems.Remove(itemToRemove);
this.MovedItems.Add(itemToRemove);
}
}
protected bool CanRemoveAllCommandExecute(object param)
{
return this.MovedItems.Count() > 0;
}
protected void RemoveAllCommandExecuted(object param)
{
var initialCount = this.MovedItems.Count();
for (int i = 0; i < initialCount; i++)
{
var itemToRemove = this.MovedItems.ElementAt(0);
this.MovedItems.Remove(itemToRemove);
this.AvailableItems.Add(itemToRemove);
}
}
private void SourceSelectedItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
this.AddCommand.InvalidateCanExecute();
}
private void TargetSelectedItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
this.RemoveCommand.InvalidateCanExecute();
}
private void AvailableItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
this.AddAllCommand.InvalidateCanExecute();
}
private void MovedItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
this.RemoveAllCommand.InvalidateCanExecute();
}
}
}