add ignoreTextChanged
This commit is contained in:
1 parent
fbaeb194e8
commit
eea87ad879
34 files changed
+733
-6
No files matched your search
@@ -402,6 +402,9 @@
|
|||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\GridPane_16x.png">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\GridPane_16x.png">
|
||||||
<Link>Resources\Img\LeftMainContent\GridPane_16x.png</Link>
|
<Link>Resources\Img\LeftMainContent\GridPane_16x.png</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\AutoComplete_16x.png">
|
||||||
|
<Link>Resources\Img\LeftMainContent\AutoComplete_16x.png</Link>
|
||||||
|
</Resource>
|
||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\under_construction.gif">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\under_construction.gif">
|
||||||
<Link>Resources\Img\under_construction.gif</Link>
|
<Link>Resources\Img\under_construction.gif</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
|||||||
@@ -11250,6 +11250,113 @@
|
|||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
<Style x:Key="AutoCompleteTextBoxInternal" BasedOn="{StaticResource ComboBoxEditableTextBox}" TargetType="TextBox" />
|
||||||
|
<Style x:Key="AutoCompleteTextBoxItemBaseStyle" TargetType="ComboBoxItem">
|
||||||
|
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}" />
|
||||||
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||||
|
<Setter Property="Background" Value="Transparent" />
|
||||||
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||||||
|
<Setter Property="BorderThickness" Value="0" />
|
||||||
|
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}" />
|
||||||
|
<Setter Property="Focusable" Value="False" />
|
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="ComboBoxItem">
|
||||||
|
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
|
||||||
|
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<MultiTrigger>
|
||||||
|
<MultiTrigger.Conditions>
|
||||||
|
<Condition Property="IsSelected" Value="False" />
|
||||||
|
<Condition Property="IsMouseOver" Value="True" />
|
||||||
|
</MultiTrigger.Conditions>
|
||||||
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource SecondaryRegionBrush}" />
|
||||||
|
</MultiTrigger>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource PrimaryBrush}" />
|
||||||
|
<Setter Property="Foreground" Value="White" />
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="AutoCompleteTextBoxBaseStyle" TargetType="hc:AutoCompleteTextBox">
|
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||||
|
<Setter Property="Background" Value="{DynamicResource RegionBrush}" />
|
||||||
|
<Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}" />
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
|
||||||
|
<Setter Property="BorderThickness" Value="1" />
|
||||||
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
|
||||||
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
|
||||||
|
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}" />
|
||||||
|
<Setter Property="ScrollViewer.CanContentScroll" Value="true" />
|
||||||
|
<Setter Property="ScrollViewer.PanningMode" Value="Both" />
|
||||||
|
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
||||||
|
<Setter Property="Padding" Value="{StaticResource DefaultInputPadding}" />
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
|
||||||
|
<Setter Property="ItemContainerStyle" Value="{StaticResource AutoCompleteTextBoxItemBaseStyle}" />
|
||||||
|
<Setter Property="IsTabStop" Value="false" />
|
||||||
|
<Setter Property="hc:Empty.ShowEmpty" Value="True" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="hc:AutoCompleteTextBox">
|
||||||
|
<hc:SimplePanel>
|
||||||
|
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
|
||||||
|
<TextBox x:Name="PART_SearchTextBox" Padding="{TemplateBinding Padding}" Style="{StaticResource AutoCompleteTextBoxInternal}" />
|
||||||
|
</Border>
|
||||||
|
<Popup x:Name="PART_Popup" AllowsTransparency="true" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" PopupAnimation="{StaticResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
|
||||||
|
<Border BorderThickness="0,1,0,0" Effect="{StaticResource EffectShadow2}" Margin="8,0,8,8" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="dropDownBorder" MinWidth="{Binding ActualWidth, ElementName=toggleButton}" MaxHeight="{TemplateBinding MaxDropDownHeight}" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}">
|
||||||
|
<hc:ToggleBlock IsChecked="{Binding HasItems,RelativeSource={RelativeSource TemplatedParent},Mode=OneWay}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
|
||||||
|
<hc:ToggleBlock.CheckedContent>
|
||||||
|
<ScrollViewer Margin="0,4">
|
||||||
|
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||||
|
</ScrollViewer>
|
||||||
|
</hc:ToggleBlock.CheckedContent>
|
||||||
|
<hc:ToggleBlock.UnCheckedContent>
|
||||||
|
<hc:Empty />
|
||||||
|
</hc:ToggleBlock.UnCheckedContent>
|
||||||
|
</hc:ToggleBlock>
|
||||||
|
</Border>
|
||||||
|
</Popup>
|
||||||
|
</hc:SimplePanel>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="HasItems" Value="false">
|
||||||
|
<Setter Property="Height" TargetName="dropDownBorder" Value="95" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="hc:DropDownElement.ConsistentWidth" Value="True">
|
||||||
|
<Setter Property="MaxWidth" TargetName="dropDownBorder" Value="{Binding ActualWidth, ElementName=PART_SearchTextBox}" />
|
||||||
|
<Setter Property="MinWidth" TargetName="dropDownBorder" Value="{Binding ActualWidth, ElementName=PART_SearchTextBox}" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="hc:DropDownElement.AutoWidth" Value="True">
|
||||||
|
<Setter Property="MaxWidth" TargetName="dropDownBorder" Value="{x:Static system:Double.MaxValue}" />
|
||||||
|
<Setter Property="MinWidth" TargetName="dropDownBorder" Value="{Binding ActualHeight, ElementName=PART_SearchTextBox}" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="true" SourceName="PART_SearchTextBox">
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}" />
|
||||||
|
</Trigger>
|
||||||
|
<MultiTrigger>
|
||||||
|
<MultiTrigger.Conditions>
|
||||||
|
<Condition Property="IsMouseOver" Value="true" />
|
||||||
|
<Condition Property="IsFocused" Value="false" SourceName="PART_SearchTextBox" />
|
||||||
|
</MultiTrigger.Conditions>
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}" />
|
||||||
|
</MultiTrigger>
|
||||||
|
<Trigger Property="IsFocused" Value="True" SourceName="PART_SearchTextBox">
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsEnabled" Value="false">
|
||||||
|
<Setter Property="Opacity" Value="0.4" />
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
<Style BasedOn="{StaticResource BadgeBaseStyle}" TargetType="hc:Badge">
|
<Style BasedOn="{StaticResource BadgeBaseStyle}" TargetType="hc:Badge">
|
||||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
|
||||||
</Style>
|
</Style>
|
||||||
@@ -12878,6 +12985,7 @@
|
|||||||
<Style BasedOn="{StaticResource TreeViewItemBaseStyle}" TargetType="TreeViewItem" />
|
<Style BasedOn="{StaticResource TreeViewItemBaseStyle}" TargetType="TreeViewItem" />
|
||||||
<Style BasedOn="{StaticResource TreeViewBaseStyle}" TargetType="TreeView" />
|
<Style BasedOn="{StaticResource TreeViewBaseStyle}" TargetType="TreeView" />
|
||||||
<Style BasedOn="{StaticResource WatermarkBaseStyle}" TargetType="hc:Watermark" />
|
<Style BasedOn="{StaticResource WatermarkBaseStyle}" TargetType="hc:Watermark" />
|
||||||
|
<Style BasedOn="{StaticResource AutoCompleteTextBoxBaseStyle}" TargetType="hc:AutoCompleteTextBox" />
|
||||||
<ControlTemplate x:Key="TipSliderThumbHorizontalTop" TargetType="Thumb">
|
<ControlTemplate x:Key="TipSliderThumbHorizontalTop" TargetType="Thumb">
|
||||||
<hc:AxleCanvas>
|
<hc:AxleCanvas>
|
||||||
<Label Name="LabelValue" IsHitTestVisible="False" Opacity="0" Canvas.Bottom="28" Style="{StaticResource LabelPrimary}" Content="{Binding Value,RelativeSource={RelativeSource AncestorType=Slider}}" ContentStringFormat="{Binding Path=(hc:TipElement.StringFormat),RelativeSource={RelativeSource AncestorType=Slider}}" />
|
<Label Name="LabelValue" IsHitTestVisible="False" Opacity="0" Canvas.Bottom="28" Style="{StaticResource LabelPrimary}" Content="{Binding Value,RelativeSource={RelativeSource AncestorType=Slider}}" ContentStringFormat="{Binding Path=(hc:TipElement.StringFormat),RelativeSource={RelativeSource AncestorType=Slider}}" />
|
||||||
|
|||||||
@@ -404,6 +404,9 @@
|
|||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\GridPane_16x.png">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\GridPane_16x.png">
|
||||||
<Link>Resources\Img\LeftMainContent\GridPane_16x.png</Link>
|
<Link>Resources\Img\LeftMainContent\GridPane_16x.png</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\AutoComplete_16x.png">
|
||||||
|
<Link>Resources\Img\LeftMainContent\AutoComplete_16x.png</Link>
|
||||||
|
</Resource>
|
||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\under_construction.gif">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\under_construction.gif">
|
||||||
<Link>Resources\Img\under_construction.gif</Link>
|
<Link>Resources\Img\under_construction.gif</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
|||||||
@@ -56,6 +56,9 @@
|
|||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\UserControl\Controls\AnimationPathDemoCtl.xaml">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\UserControl\Controls\AnimationPathDemoCtl.xaml">
|
||||||
<Link>UserControl\Controls\AnimationPathDemoCtl.xaml</Link>
|
<Link>UserControl\Controls\AnimationPathDemoCtl.xaml</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\UserControl\Controls\AutoCompleteTextBoxDemoCtl.xaml">
|
||||||
|
<Link>UserControl\Controls\AutoCompleteTextBoxDemoCtl.xaml</Link>
|
||||||
|
</Resource>
|
||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\UserControl\Controls\BadgeDemoCtl.xaml">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\UserControl\Controls\BadgeDemoCtl.xaml">
|
||||||
<Link>UserControl\Controls\BadgeDemoCtl.xaml</Link>
|
<Link>UserControl\Controls\BadgeDemoCtl.xaml</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
@@ -431,6 +434,10 @@
|
|||||||
<Link>UserControl\Controls\AnimationPathDemoCtl.xaml.cs</Link>
|
<Link>UserControl\Controls\AnimationPathDemoCtl.xaml.cs</Link>
|
||||||
<DependentUpon>AnimationPathDemoCtl.xaml</DependentUpon>
|
<DependentUpon>AnimationPathDemoCtl.xaml</DependentUpon>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\UserControl\Controls\AutoCompleteTextBoxDemoCtl.xaml.cs">
|
||||||
|
<Link>UserControl\Controls\AutoCompleteTextBoxDemoCtl.xaml.cs</Link>
|
||||||
|
<DependentUpon>AutoCompleteTextBoxDemoCtl.xaml</DependentUpon>
|
||||||
|
</Resource>
|
||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\UserControl\Controls\BadgeDemoCtl.xaml.cs">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\UserControl\Controls\BadgeDemoCtl.xaml.cs">
|
||||||
<Link>UserControl\Controls\BadgeDemoCtl.xaml.cs</Link>
|
<Link>UserControl\Controls\BadgeDemoCtl.xaml.cs</Link>
|
||||||
<DependentUpon>BadgeDemoCtl.xaml</DependentUpon>
|
<DependentUpon>BadgeDemoCtl.xaml</DependentUpon>
|
||||||
@@ -850,6 +857,9 @@
|
|||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\ViewModel\Common\ComboBoxDemoViewModel.cs">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\ViewModel\Common\ComboBoxDemoViewModel.cs">
|
||||||
<Link>ViewModel\ComboBoxDemoViewModel.cs</Link>
|
<Link>ViewModel\ComboBoxDemoViewModel.cs</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\ViewModel\Controls\AutoCompleteTextBoxDemoViewModel.cs">
|
||||||
|
<Link>ViewModel\AutoCompleteTextBoxDemoViewModel.cs</Link>
|
||||||
|
</Resource>
|
||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\ViewModel\Controls\BadgeDemoViewModel.cs">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\ViewModel\Controls\BadgeDemoViewModel.cs">
|
||||||
<Link>ViewModel\BadgeDemoViewModel.cs</Link>
|
<Link>ViewModel\BadgeDemoViewModel.cs</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
"demoItemList": [
|
"demoItemList": [
|
||||||
[ "FloatingBlock", "FloatingBlockDemoCtl", "thumbs_up", "", "Interacting" ],
|
[ "FloatingBlock", "FloatingBlockDemoCtl", "thumbs_up", "", "Interacting" ],
|
||||||
[ "PropertyGrid", "PropertyGridDemoCtl", "PropertyGridEditorPart_16x", "", "DataEntry" ],
|
[ "PropertyGrid", "PropertyGridDemoCtl", "PropertyGridEditorPart_16x", "", "DataEntry" ],
|
||||||
[ "ImageSelector", "ImageSelectorDemoCtl", "Image_16x", "1", "DataEntry" ],
|
[ "ImageSelector", "ImageSelectorDemoCtl", "Image_16x", "", "DataEntry" ],
|
||||||
[ "ImageBlock", "ImageBlockDemoCtl", "ImageStack_16x", "", "DataDisplay" ],
|
[ "ImageBlock", "ImageBlockDemoCtl", "ImageStack_16x", "", "DataDisplay" ],
|
||||||
[ "Magnifier", "MagnifierDemoCtl", "Search_16x", "", "Interacting" ],
|
[ "Magnifier", "MagnifierDemoCtl", "Search_16x", "", "Interacting" ],
|
||||||
[ "Gravatar", "GravatarDemoCtl", "User_16x", "", "DataDisplay" ],
|
[ "Gravatar", "GravatarDemoCtl", "User_16x", "", "DataDisplay" ],
|
||||||
@@ -57,6 +57,7 @@
|
|||||||
[ "TextBox", "TextBoxDemoCtl", "TextBox_16x", "", "DataEntry" ],
|
[ "TextBox", "TextBoxDemoCtl", "TextBox_16x", "", "DataEntry" ],
|
||||||
[ "ComboBox", "ComboBoxDemoCtl", "ComboBox_16x", "", "DataEntry" ],
|
[ "ComboBox", "ComboBoxDemoCtl", "ComboBox_16x", "", "DataEntry" ],
|
||||||
[ "CheckComboBox", "CheckComboBoxDemoCtl", "CheckBoxList_16x", "1", "DataEntry" ],
|
[ "CheckComboBox", "CheckComboBoxDemoCtl", "CheckBoxList_16x", "1", "DataEntry" ],
|
||||||
|
[ "AutoCompleteTextBox", "AutoCompleteTextBoxDemoCtl", "AutoComplete_16x", "1", "DataEntry" ],
|
||||||
[ "PasswordBox", "PasswordBoxDemoCtl", "PasswordBox_16x", "", "DataEntry" ],
|
[ "PasswordBox", "PasswordBoxDemoCtl", "PasswordBox_16x", "", "DataEntry" ],
|
||||||
[ "PinBox", "PinBoxDemoCtl", "Ellipsis_16x", "", "DataEntry" ],
|
[ "PinBox", "PinBoxDemoCtl", "Ellipsis_16x", "", "DataEntry" ],
|
||||||
[ "DatePicker", "DatePickerDemoCtl", "DatePicker_16x", "", "DataEntry" ],
|
[ "DatePicker", "DatePickerDemoCtl", "DatePicker_16x", "", "DataEntry" ],
|
||||||
|
|||||||
@@ -60,6 +60,9 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Basic\TextDialogWithTimer.xaml.cs">
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Basic\TextDialogWithTimer.xaml.cs">
|
||||||
<DependentUpon>TextDialogWithTimer.xaml</DependentUpon>
|
<DependentUpon>TextDialogWithTimer.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\AutoCompleteTextBoxDemoCtl.xaml.cs">
|
||||||
|
<DependentUpon>AutoCompleteTextBoxDemoCtl.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\ElementGroupDemoCtl.xaml.cs">
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\ElementGroupDemoCtl.xaml.cs">
|
||||||
<DependentUpon>ElementGroupDemoCtl.xaml</DependentUpon>
|
<DependentUpon>ElementGroupDemoCtl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -408,6 +411,7 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Basic\ChatBoxViewModel.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Basic\ChatBoxViewModel.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Basic\InteractiveDialogViewModel.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Basic\InteractiveDialogViewModel.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Common\ComboBoxDemoViewModel.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Common\ComboBoxDemoViewModel.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\AutoCompleteTextBoxDemoViewModel.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\BadgeDemoViewModel.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\BadgeDemoViewModel.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\CardDemoViewModel.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\CardDemoViewModel.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\CoverViewModel.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModel\Controls\CoverViewModel.cs" />
|
||||||
@@ -540,6 +544,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\AutoCompleteTextBoxDemoCtl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\ElementGroupDemoCtl.xaml">
|
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\ElementGroupDemoCtl.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@@ -124,6 +124,17 @@ namespace HandyControlDemo.Properties.Langs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to 自动补全文本框.
|
||||||
|
/// </summary>
|
||||||
|
public static string AutoCompleteTextBox
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ResourceManager.GetString("AutoCompleteTextBox", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to 标记.
|
/// Looks up a localized string similar to 标记.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -798,4 +798,7 @@
|
|||||||
<data name="ElementGroup" xml:space="preserve">
|
<data name="ElementGroup" xml:space="preserve">
|
||||||
<value>ElementGroup</value>
|
<value>ElementGroup</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="AutoCompleteTextBox" xml:space="preserve">
|
||||||
|
<value>AutoCompleteTextBox</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -798,4 +798,7 @@
|
|||||||
<data name="ElementGroup" xml:space="preserve">
|
<data name="ElementGroup" xml:space="preserve">
|
||||||
<value>ElementGroup</value>
|
<value>ElementGroup</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="AutoCompleteTextBox" xml:space="preserve">
|
||||||
|
<value>AutoCompleteTextBox</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
@@ -798,4 +798,7 @@
|
|||||||
<data name="ElementGroup" xml:space="preserve">
|
<data name="ElementGroup" xml:space="preserve">
|
||||||
<value>ElementGroup</value>
|
<value>ElementGroup</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="AutoCompleteTextBox" xml:space="preserve">
|
||||||
|
<value>AutoCompleteTextBox</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -798,4 +798,7 @@
|
|||||||
<data name="ElementGroup" xml:space="preserve">
|
<data name="ElementGroup" xml:space="preserve">
|
||||||
<value>ElementGroup</value>
|
<value>ElementGroup</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="AutoCompleteTextBox" xml:space="preserve">
|
||||||
|
<value>AutoCompleteTextBox</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -798,4 +798,7 @@
|
|||||||
<data name="ElementGroup" xml:space="preserve">
|
<data name="ElementGroup" xml:space="preserve">
|
||||||
<value>ElementGroup</value>
|
<value>ElementGroup</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="AutoCompleteTextBox" xml:space="preserve">
|
||||||
|
<value>AutoCompleteTextBox</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -798,4 +798,7 @@
|
|||||||
<data name="ElementGroup" xml:space="preserve">
|
<data name="ElementGroup" xml:space="preserve">
|
||||||
<value>ElementGroup</value>
|
<value>ElementGroup</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="AutoCompleteTextBox" xml:space="preserve">
|
||||||
|
<value>AutoCompleteTextBox</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -798,4 +798,7 @@
|
|||||||
<data name="ElementGroup" xml:space="preserve">
|
<data name="ElementGroup" xml:space="preserve">
|
||||||
<value>ElementGroup</value>
|
<value>ElementGroup</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="AutoCompleteTextBox" xml:space="preserve">
|
||||||
|
<value>AutoCompleteTextBox</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -798,4 +798,7 @@
|
|||||||
<data name="ElementGroup" xml:space="preserve">
|
<data name="ElementGroup" xml:space="preserve">
|
||||||
<value>ElementGroup</value>
|
<value>ElementGroup</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="AutoCompleteTextBox" xml:space="preserve">
|
||||||
|
<value>AutoCompleteTextBox</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -798,4 +798,7 @@
|
|||||||
<data name="ElementGroup" xml:space="preserve">
|
<data name="ElementGroup" xml:space="preserve">
|
||||||
<value>元素组</value>
|
<value>元素组</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="AutoCompleteTextBox" xml:space="preserve">
|
||||||
|
<value>自动补全文本框</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -798,4 +798,7 @@
|
|||||||
<data name="ElementGroup" xml:space="preserve">
|
<data name="ElementGroup" xml:space="preserve">
|
||||||
<value>ElementGroup</value>
|
<value>ElementGroup</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="AutoCompleteTextBox" xml:space="preserve">
|
||||||
|
<value>AutoCompleteTextBox</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -798,4 +798,7 @@
|
|||||||
<data name="ElementGroup" xml:space="preserve">
|
<data name="ElementGroup" xml:space="preserve">
|
||||||
<value>ElementGroup</value>
|
<value>ElementGroup</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="AutoCompleteTextBox" xml:space="preserve">
|
||||||
|
<value>AutoCompleteTextBox</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -42,6 +42,7 @@ namespace HandyControlDemo.Properties.Langs
|
|||||||
OnPropertyChanged(nameof(AnimationPath));
|
OnPropertyChanged(nameof(AnimationPath));
|
||||||
OnPropertyChanged(nameof(AppClosingTip));
|
OnPropertyChanged(nameof(AppClosingTip));
|
||||||
OnPropertyChanged(nameof(Ask));
|
OnPropertyChanged(nameof(Ask));
|
||||||
|
OnPropertyChanged(nameof(AutoCompleteTextBox));
|
||||||
OnPropertyChanged(nameof(Badge));
|
OnPropertyChanged(nameof(Badge));
|
||||||
OnPropertyChanged(nameof(BasicInfo));
|
OnPropertyChanged(nameof(BasicInfo));
|
||||||
OnPropertyChanged(nameof(BasicLayout));
|
OnPropertyChanged(nameof(BasicLayout));
|
||||||
@@ -291,6 +292,11 @@ namespace HandyControlDemo.Properties.Langs
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Ask => Lang.Ask;
|
public string Ask => Lang.Ask;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 自动补全文本框 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public string AutoCompleteTextBox => Lang.AutoCompleteTextBox;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 标记 的本地化字符串。
|
/// 查找类似 标记 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -564,7 +570,7 @@ namespace HandyControlDemo.Properties.Langs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 元素组 的本地化字符串。
|
/// 查找类似 元素组 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ElementGroup => Lang.ElementGroup;
|
public string ElementGroup => Lang.ElementGroup;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 邮箱 的本地化字符串。
|
/// 查找类似 邮箱 的本地化字符串。
|
||||||
@@ -574,7 +580,7 @@ namespace HandyControlDemo.Properties.Langs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 空状态 的本地化字符串。
|
/// 查找类似 空状态 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Empty => Lang.Empty;
|
public string Empty => Lang.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 错误 的本地化字符串。
|
/// 查找类似 错误 的本地化字符串。
|
||||||
@@ -1435,6 +1441,11 @@ namespace HandyControlDemo.Properties.Langs
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static string Ask = nameof(Ask);
|
public static string Ask = nameof(Ask);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 自动补全文本框 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string AutoCompleteTextBox = nameof(AutoCompleteTextBox);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 标记 的本地化字符串。
|
/// 查找类似 标记 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1708,7 +1719,7 @@ namespace HandyControlDemo.Properties.Langs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 元素组 的本地化字符串。
|
/// 查找类似 元素组 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string ElementGroup = nameof(ElementGroup);
|
public static string ElementGroup = nameof(ElementGroup);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 邮箱 的本地化字符串。
|
/// 查找类似 邮箱 的本地化字符串。
|
||||||
@@ -1718,7 +1729,7 @@ namespace HandyControlDemo.Properties.Langs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 空状态 的本地化字符串。
|
/// 查找类似 空状态 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string Empty = nameof(Empty);
|
public static string Empty = nameof(Empty);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 错误 的本地化字符串。
|
/// 查找类似 错误 的本地化字符串。
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 175 B |
+10
@@ -0,0 +1,10 @@
|
|||||||
|
<UserControl x:Class="HandyControlDemo.UserControl.AutoCompleteTextBoxDemoCtl"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
Background="{DynamicResource RegionBrush}"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
DataContext="{Binding AutoCompleteTextBoxDemo, Source={StaticResource Locator}}">
|
||||||
|
<hc:TransitioningContentControl>
|
||||||
|
<hc:AutoCompleteTextBox Width="380" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="32" ItemsSource="{Binding Items}" Text="{Binding SearchText}" DisplayMemberPath="Name"/>
|
||||||
|
</hc:TransitioningContentControl>
|
||||||
|
</UserControl>
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
namespace HandyControlDemo.UserControl
|
||||||
|
{
|
||||||
|
public partial class AutoCompleteTextBoxDemoCtl
|
||||||
|
{
|
||||||
|
public AutoCompleteTextBoxDemoCtl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+57
@@ -0,0 +1,57 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using GalaSoft.MvvmLight;
|
||||||
|
using HandyControl.Collections;
|
||||||
|
using HandyControlDemo.Data;
|
||||||
|
using HandyControlDemo.Service;
|
||||||
|
|
||||||
|
namespace HandyControlDemo.ViewModel
|
||||||
|
{
|
||||||
|
public class AutoCompleteTextBoxDemoViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
private string _searchText;
|
||||||
|
|
||||||
|
public string SearchText
|
||||||
|
{
|
||||||
|
get => _searchText;
|
||||||
|
#if NET40
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Set(nameof(SearchText), ref _searchText, value);
|
||||||
|
FilterItems(value);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Set(ref _searchText, value);
|
||||||
|
FilterItems(value);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public ManualObservableCollection<DemoDataModel> Items { get; set; } = new();
|
||||||
|
|
||||||
|
private readonly List<DemoDataModel> _dataList;
|
||||||
|
|
||||||
|
public AutoCompleteTextBoxDemoViewModel(DataService dataService)
|
||||||
|
{
|
||||||
|
_dataList = dataService.GetDemoDataList(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FilterItems(string key)
|
||||||
|
{
|
||||||
|
Items.CanNotify = false;
|
||||||
|
|
||||||
|
Items.Clear();
|
||||||
|
|
||||||
|
foreach (var data in _dataList)
|
||||||
|
{
|
||||||
|
if (data.Name.Contains(key))
|
||||||
|
{
|
||||||
|
Items.Add(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Items.CanNotify = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,6 +39,7 @@ namespace HandyControlDemo.ViewModel
|
|||||||
SimpleIoc.Default.Register<NotificationDemoViewModel>();
|
SimpleIoc.Default.Register<NotificationDemoViewModel>();
|
||||||
SimpleIoc.Default.Register<SplitButtonDemoViewModel>();
|
SimpleIoc.Default.Register<SplitButtonDemoViewModel>();
|
||||||
SimpleIoc.Default.Register<TagDemoViewModel>();
|
SimpleIoc.Default.Register<TagDemoViewModel>();
|
||||||
|
SimpleIoc.Default.Register<AutoCompleteTextBoxDemoViewModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ViewModelLocator Instance = new Lazy<ViewModelLocator>(() =>
|
public static ViewModelLocator Instance = new Lazy<ViewModelLocator>(() =>
|
||||||
@@ -100,6 +101,8 @@ namespace HandyControlDemo.ViewModel
|
|||||||
|
|
||||||
public TagDemoViewModel TagDemo => new(SimpleIoc.Default.GetInstance<DataService>());
|
public TagDemoViewModel TagDemo => new(SimpleIoc.Default.GetInstance<DataService>());
|
||||||
|
|
||||||
|
public AutoCompleteTextBoxDemoViewModel AutoCompleteTextBoxDemo => new(SimpleIoc.Default.GetInstance<DataService>());
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@@ -41,6 +42,19 @@ namespace HandyControl.Collections
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ManualObservableCollection()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ManualObservableCollection(List<T> list) : base(list != null ? new List<T>(list.Count) : list) => CopyFrom(list);
|
||||||
|
|
||||||
|
public ManualObservableCollection(IEnumerable<T> collection)
|
||||||
|
{
|
||||||
|
if (collection == null) throw new ArgumentNullException(nameof(collection));
|
||||||
|
CopyFrom(collection);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnPropertyChanged(PropertyChangedEventArgs e)
|
protected override void OnPropertyChanged(PropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!CanNotify) return;
|
if (!CanNotify) return;
|
||||||
@@ -54,5 +68,18 @@ namespace HandyControl.Collections
|
|||||||
|
|
||||||
base.OnCollectionChanged(e);
|
base.OnCollectionChanged(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CopyFrom(IEnumerable<T> collection)
|
||||||
|
{
|
||||||
|
var items = Items;
|
||||||
|
if (collection != null)
|
||||||
|
{
|
||||||
|
using var enumerator = collection.GetEnumerator();
|
||||||
|
while (enumerator.MoveNext())
|
||||||
|
{
|
||||||
|
items.Add(enumerator.Current);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+150
@@ -0,0 +1,150 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using HandyControl.Data;
|
||||||
|
using HandyControl.Tools.Helper;
|
||||||
|
|
||||||
|
namespace HandyControl.Controls
|
||||||
|
{
|
||||||
|
[TemplatePart(Name = SearchTextBox, Type = typeof(System.Windows.Controls.TextBox))]
|
||||||
|
public class AutoCompleteTextBox : ComboBox
|
||||||
|
{
|
||||||
|
private const string SearchTextBox = "PART_SearchTextBox";
|
||||||
|
|
||||||
|
private bool ignoreTextChanging;
|
||||||
|
|
||||||
|
private System.Windows.Controls.TextBox _searchTextBox;
|
||||||
|
|
||||||
|
private object _selectedItem;
|
||||||
|
|
||||||
|
static AutoCompleteTextBox()
|
||||||
|
{
|
||||||
|
TextProperty.OverrideMetadata(typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(default(string), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnApplyTemplate()
|
||||||
|
{
|
||||||
|
if (_searchTextBox != null)
|
||||||
|
{
|
||||||
|
_searchTextBox.GotFocus -= SearchTextBoxGotFocus;
|
||||||
|
_searchTextBox.KeyDown -= SearchTextBoxKeyDown;
|
||||||
|
_searchTextBox.TextChanged -= SearchTextBoxTextChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
base.OnApplyTemplate();
|
||||||
|
|
||||||
|
_searchTextBox = GetTemplateChild(SearchTextBox) as System.Windows.Controls.TextBox;
|
||||||
|
if (_searchTextBox != null)
|
||||||
|
{
|
||||||
|
_searchTextBox.GotFocus += SearchTextBoxGotFocus;
|
||||||
|
_searchTextBox.PreviewKeyDown += SearchTextBoxKeyDown;
|
||||||
|
_searchTextBox.TextChanged += SearchTextBoxTextChanged;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSelectionChanged(SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.AddedItems.Count > 0)
|
||||||
|
{
|
||||||
|
_selectedItem = e.AddedItems[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDropDownClosed(EventArgs e)
|
||||||
|
{
|
||||||
|
base.OnDropDownClosed(e);
|
||||||
|
|
||||||
|
if (ItemContainerGenerator.ContainerFromItem(_selectedItem) is AutoCompleteTextBoxItem boxItem)
|
||||||
|
{
|
||||||
|
ignoreTextChanging = true;
|
||||||
|
|
||||||
|
_searchTextBox.Text = BindingHelper.GetString(boxItem.Content, DisplayMemberPath);
|
||||||
|
_searchTextBox.CaretIndex = _searchTextBox.Text.Length;
|
||||||
|
|
||||||
|
ignoreTextChanging = true;
|
||||||
|
|
||||||
|
Text = _searchTextBox.Text;
|
||||||
|
|
||||||
|
ignoreTextChanging = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool IsItemItsOwnContainerOverride(object item) => item is AutoCompleteTextBoxItem;
|
||||||
|
|
||||||
|
protected override DependencyObject GetContainerForItemOverride() => new AutoCompleteTextBoxItem();
|
||||||
|
|
||||||
|
private void SearchTextBoxTextChanged(object sender, TextChangedEventArgs e)
|
||||||
|
{
|
||||||
|
_selectedItem = null;
|
||||||
|
SelectedIndex = -1;
|
||||||
|
|
||||||
|
if (ignoreTextChanging)
|
||||||
|
{
|
||||||
|
ignoreTextChanging = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Text = _searchTextBox.Text;
|
||||||
|
if (string.IsNullOrEmpty(Text))
|
||||||
|
{
|
||||||
|
SetCurrentValue(IsDropDownOpenProperty, ValueBoxes.FalseBox);
|
||||||
|
_searchTextBox.Focus();
|
||||||
|
}
|
||||||
|
else if (_searchTextBox.IsFocused)
|
||||||
|
{
|
||||||
|
SetCurrentValue(IsDropDownOpenProperty, ValueBoxes.TrueBox);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SearchTextBoxKeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Up)
|
||||||
|
{
|
||||||
|
var index = SelectedIndex - 1;
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
index = Items.Count - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateTextBoxBySelectedIndex(index);
|
||||||
|
}
|
||||||
|
else if (e.Key == Key.Down)
|
||||||
|
{
|
||||||
|
var index = SelectedIndex + 1;
|
||||||
|
if (index >= Items.Count)
|
||||||
|
{
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateTextBoxBySelectedIndex(index);
|
||||||
|
}
|
||||||
|
else if (e.Key == Key.Enter)
|
||||||
|
{
|
||||||
|
SetCurrentValue(IsDropDownOpenProperty, ValueBoxes.FalseBox);
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateTextBoxBySelectedIndex(int selectedIndex)
|
||||||
|
{
|
||||||
|
ignoreTextChanging = true;
|
||||||
|
|
||||||
|
if (ItemContainerGenerator.ContainerFromIndex(selectedIndex) is AutoCompleteTextBoxItem boxItem)
|
||||||
|
{
|
||||||
|
_searchTextBox.Text = BindingHelper.GetString(boxItem.Content, DisplayMemberPath);
|
||||||
|
_searchTextBox.CaretIndex = _searchTextBox.Text.Length;
|
||||||
|
|
||||||
|
SelectedIndex = selectedIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SearchTextBoxGotFocus(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(Text))
|
||||||
|
{
|
||||||
|
SetCurrentValue(IsDropDownOpenProperty, ValueBoxes.TrueBox);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace HandyControl.Controls
|
||||||
|
{
|
||||||
|
public class AutoCompleteTextBoxItem : ComboBoxItem
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,6 +35,8 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Drawer\DrawerContainer.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Drawer\DrawerContainer.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Growl\GrowlWindow.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Growl\GrowlWindow.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Image\ImageBlock.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Image\ImageBlock.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Input\AutoCompleteTextBox\AutoCompleteTextBox.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Input\AutoCompleteTextBox\AutoCompleteTextBoxItem.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Input\CheckComboBox\CheckComboBox.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Input\CheckComboBox\CheckComboBox.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Input\CheckComboBox\CheckComboBoxItem.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Input\CheckComboBox\CheckComboBoxItem.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Input\ImageSelector.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Controls\Input\ImageSelector.cs" />
|
||||||
@@ -369,6 +371,7 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Generator\HatchBrushGenerator.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Tools\Generator\HatchBrushGenerator.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\AnimationHelper.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\AnimationHelper.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\ArithmeticHelper.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\ArithmeticHelper.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\BindingHelper.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\ColorHelper.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\ColorHelper.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\ConfigHelper.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\ConfigHelper.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\DesignerHelper.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Tools\Helper\DesignerHelper.cs" />
|
||||||
@@ -416,6 +419,12 @@
|
|||||||
<None Include="$(MSBuildThisFileDirectory)Themes\Basic\Brushes.xaml">
|
<None Include="$(MSBuildThisFileDirectory)Themes\Basic\Brushes.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="$(MSBuildThisFileDirectory)Themes\Styles\AutoCompleteTextBox.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</None>
|
||||||
|
<None Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\AutoCompleteTextBoxBaseStyle.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</None>
|
||||||
<None Include="$(MSBuildThisFileDirectory)Themes\XamlCombine.exe" />
|
<None Include="$(MSBuildThisFileDirectory)Themes\XamlCombine.exe" />
|
||||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Basic\Colors\Colors.xaml">
|
<Page Include="$(MSBuildThisFileDirectory)Themes\Basic\Colors\Colors.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:hc="clr-namespace:HandyControl.Controls">
|
||||||
|
|
||||||
|
<Style BasedOn="{StaticResource AutoCompleteTextBoxBaseStyle}" TargetType="hc:AutoCompleteTextBox"/>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:hc="clr-namespace:HandyControl.Controls">
|
||||||
|
|
||||||
|
<Style x:Key="AutoCompleteTextBoxInternal" BasedOn="{StaticResource ComboBoxEditableTextBox}" TargetType="TextBox"/>
|
||||||
|
|
||||||
|
<Style x:Key="AutoCompleteTextBoxItemBaseStyle" TargetType="ComboBoxItem">
|
||||||
|
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/>
|
||||||
|
<Setter Property="SnapsToDevicePixels" Value="True"/>
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}"/>
|
||||||
|
<Setter Property="Focusable" Value="False"/>
|
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="ComboBoxItem">
|
||||||
|
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
|
||||||
|
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<MultiTrigger>
|
||||||
|
<MultiTrigger.Conditions>
|
||||||
|
<Condition Property="IsSelected" Value="False"/>
|
||||||
|
<Condition Property="IsMouseOver" Value="True"/>
|
||||||
|
</MultiTrigger.Conditions>
|
||||||
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource SecondaryRegionBrush}"/>
|
||||||
|
</MultiTrigger>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource PrimaryBrush}"/>
|
||||||
|
<Setter Property="Foreground" Value="White"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="AutoCompleteTextBoxBaseStyle" TargetType="hc:AutoCompleteTextBox">
|
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||||
|
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
||||||
|
<Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
|
||||||
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
|
||||||
|
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}"/>
|
||||||
|
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
|
||||||
|
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
|
||||||
|
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
|
||||||
|
<Setter Property="Padding" Value="{StaticResource DefaultInputPadding}"/>
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||||
|
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
|
||||||
|
<Setter Property="ItemContainerStyle" Value="{StaticResource AutoCompleteTextBoxItemBaseStyle}"/>
|
||||||
|
<Setter Property="IsTabStop" Value="false"/>
|
||||||
|
<Setter Property="hc:Empty.ShowEmpty" Value="True"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="hc:AutoCompleteTextBox">
|
||||||
|
<hc:SimplePanel>
|
||||||
|
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
|
||||||
|
<TextBox x:Name="PART_SearchTextBox" Padding="{TemplateBinding Padding}" Style="{StaticResource AutoCompleteTextBoxInternal}"/>
|
||||||
|
</Border>
|
||||||
|
<Popup x:Name="PART_Popup" AllowsTransparency="true" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" PopupAnimation="{StaticResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
|
||||||
|
<Border BorderThickness="0,1,0,0" Effect="{StaticResource EffectShadow2}" Margin="8,0,8,8" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="dropDownBorder" MinWidth="{Binding ActualWidth, ElementName=toggleButton}" MaxHeight="{TemplateBinding MaxDropDownHeight}" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}">
|
||||||
|
<hc:ToggleBlock IsChecked="{Binding HasItems,RelativeSource={RelativeSource TemplatedParent},Mode=OneWay}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
|
||||||
|
<hc:ToggleBlock.CheckedContent>
|
||||||
|
<ScrollViewer Margin="0,4">
|
||||||
|
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||||
|
</ScrollViewer>
|
||||||
|
</hc:ToggleBlock.CheckedContent>
|
||||||
|
<hc:ToggleBlock.UnCheckedContent>
|
||||||
|
<hc:Empty/>
|
||||||
|
</hc:ToggleBlock.UnCheckedContent>
|
||||||
|
</hc:ToggleBlock>
|
||||||
|
</Border>
|
||||||
|
</Popup>
|
||||||
|
</hc:SimplePanel>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="HasItems" Value="false">
|
||||||
|
<Setter Property="Height" TargetName="dropDownBorder" Value="95"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="hc:DropDownElement.ConsistentWidth" Value="True">
|
||||||
|
<Setter Property="MaxWidth" TargetName="dropDownBorder" Value="{Binding ActualWidth, ElementName=PART_SearchTextBox}"/>
|
||||||
|
<Setter Property="MinWidth" TargetName="dropDownBorder" Value="{Binding ActualWidth, ElementName=PART_SearchTextBox}"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="hc:DropDownElement.AutoWidth" Value="True">
|
||||||
|
<Setter Property="MaxWidth" TargetName="dropDownBorder" Value="{x:Static system:Double.MaxValue}" />
|
||||||
|
<Setter Property="MinWidth" TargetName="dropDownBorder" Value="{Binding ActualHeight, ElementName=PART_SearchTextBox}" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="true" SourceName="PART_SearchTextBox">
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
<MultiTrigger>
|
||||||
|
<MultiTrigger.Conditions>
|
||||||
|
<Condition Property="IsMouseOver" Value="true"/>
|
||||||
|
<Condition Property="IsFocused" Value="false" SourceName="PART_SearchTextBox"/>
|
||||||
|
</MultiTrigger.Conditions>
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}"/>
|
||||||
|
</MultiTrigger>
|
||||||
|
<Trigger Property="IsFocused" Value="True" SourceName="PART_SearchTextBox">
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsEnabled" Value="false">
|
||||||
|
<Setter Property="Opacity" Value="0.4"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -11383,6 +11383,113 @@
|
|||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
<Style x:Key="AutoCompleteTextBoxInternal" BasedOn="{StaticResource ComboBoxEditableTextBox}" TargetType="TextBox" />
|
||||||
|
<Style x:Key="AutoCompleteTextBoxItemBaseStyle" TargetType="ComboBoxItem">
|
||||||
|
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}" />
|
||||||
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||||
|
<Setter Property="Background" Value="Transparent" />
|
||||||
|
<Setter Property="BorderBrush" Value="Transparent" />
|
||||||
|
<Setter Property="BorderThickness" Value="0" />
|
||||||
|
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}" />
|
||||||
|
<Setter Property="Focusable" Value="False" />
|
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="ComboBoxItem">
|
||||||
|
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
|
||||||
|
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<MultiTrigger>
|
||||||
|
<MultiTrigger.Conditions>
|
||||||
|
<Condition Property="IsSelected" Value="False" />
|
||||||
|
<Condition Property="IsMouseOver" Value="True" />
|
||||||
|
</MultiTrigger.Conditions>
|
||||||
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource SecondaryRegionBrush}" />
|
||||||
|
</MultiTrigger>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource PrimaryBrush}" />
|
||||||
|
<Setter Property="Foreground" Value="White" />
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="AutoCompleteTextBoxBaseStyle" TargetType="hc:AutoCompleteTextBox">
|
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||||
|
<Setter Property="Background" Value="{DynamicResource RegionBrush}" />
|
||||||
|
<Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}" />
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
|
||||||
|
<Setter Property="BorderThickness" Value="1" />
|
||||||
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
|
||||||
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
|
||||||
|
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}" />
|
||||||
|
<Setter Property="ScrollViewer.CanContentScroll" Value="true" />
|
||||||
|
<Setter Property="ScrollViewer.PanningMode" Value="Both" />
|
||||||
|
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
||||||
|
<Setter Property="Padding" Value="{StaticResource DefaultInputPadding}" />
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}" />
|
||||||
|
<Setter Property="ItemContainerStyle" Value="{StaticResource AutoCompleteTextBoxItemBaseStyle}" />
|
||||||
|
<Setter Property="IsTabStop" Value="false" />
|
||||||
|
<Setter Property="hc:Empty.ShowEmpty" Value="True" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="hc:AutoCompleteTextBox">
|
||||||
|
<hc:SimplePanel>
|
||||||
|
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
|
||||||
|
<TextBox x:Name="PART_SearchTextBox" Padding="{TemplateBinding Padding}" Style="{StaticResource AutoCompleteTextBoxInternal}" />
|
||||||
|
</Border>
|
||||||
|
<Popup x:Name="PART_Popup" AllowsTransparency="true" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" PopupAnimation="{StaticResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
|
||||||
|
<Border BorderThickness="0,1,0,0" Effect="{StaticResource EffectShadow2}" Margin="8,0,8,8" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="dropDownBorder" MinWidth="{Binding ActualWidth, ElementName=toggleButton}" MaxHeight="{TemplateBinding MaxDropDownHeight}" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}">
|
||||||
|
<hc:ToggleBlock IsChecked="{Binding HasItems,RelativeSource={RelativeSource TemplatedParent},Mode=OneWay}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
|
||||||
|
<hc:ToggleBlock.CheckedContent>
|
||||||
|
<ScrollViewer Margin="0,4">
|
||||||
|
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||||
|
</ScrollViewer>
|
||||||
|
</hc:ToggleBlock.CheckedContent>
|
||||||
|
<hc:ToggleBlock.UnCheckedContent>
|
||||||
|
<hc:Empty />
|
||||||
|
</hc:ToggleBlock.UnCheckedContent>
|
||||||
|
</hc:ToggleBlock>
|
||||||
|
</Border>
|
||||||
|
</Popup>
|
||||||
|
</hc:SimplePanel>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="HasItems" Value="false">
|
||||||
|
<Setter Property="Height" TargetName="dropDownBorder" Value="95" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="hc:DropDownElement.ConsistentWidth" Value="True">
|
||||||
|
<Setter Property="MaxWidth" TargetName="dropDownBorder" Value="{Binding ActualWidth, ElementName=PART_SearchTextBox}" />
|
||||||
|
<Setter Property="MinWidth" TargetName="dropDownBorder" Value="{Binding ActualWidth, ElementName=PART_SearchTextBox}" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="hc:DropDownElement.AutoWidth" Value="True">
|
||||||
|
<Setter Property="MaxWidth" TargetName="dropDownBorder" Value="{x:Static system:Double.MaxValue}" />
|
||||||
|
<Setter Property="MinWidth" TargetName="dropDownBorder" Value="{Binding ActualHeight, ElementName=PART_SearchTextBox}" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="true" SourceName="PART_SearchTextBox">
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}" />
|
||||||
|
</Trigger>
|
||||||
|
<MultiTrigger>
|
||||||
|
<MultiTrigger.Conditions>
|
||||||
|
<Condition Property="IsMouseOver" Value="true" />
|
||||||
|
<Condition Property="IsFocused" Value="false" SourceName="PART_SearchTextBox" />
|
||||||
|
</MultiTrigger.Conditions>
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}" />
|
||||||
|
</MultiTrigger>
|
||||||
|
<Trigger Property="IsFocused" Value="True" SourceName="PART_SearchTextBox">
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsEnabled" Value="false">
|
||||||
|
<Setter Property="Opacity" Value="0.4" />
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
<Style BasedOn="{StaticResource BadgeBaseStyle}" TargetType="hc:Badge">
|
<Style BasedOn="{StaticResource BadgeBaseStyle}" TargetType="hc:Badge">
|
||||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
|
||||||
</Style>
|
</Style>
|
||||||
@@ -13028,6 +13135,7 @@
|
|||||||
<Style BasedOn="{StaticResource TreeViewItemBaseStyle}" TargetType="TreeViewItem" />
|
<Style BasedOn="{StaticResource TreeViewItemBaseStyle}" TargetType="TreeViewItem" />
|
||||||
<Style BasedOn="{StaticResource TreeViewBaseStyle}" TargetType="TreeView" />
|
<Style BasedOn="{StaticResource TreeViewBaseStyle}" TargetType="TreeView" />
|
||||||
<Style BasedOn="{StaticResource WatermarkBaseStyle}" TargetType="hc:Watermark" />
|
<Style BasedOn="{StaticResource WatermarkBaseStyle}" TargetType="hc:Watermark" />
|
||||||
|
<Style BasedOn="{StaticResource AutoCompleteTextBoxBaseStyle}" TargetType="hc:AutoCompleteTextBox" />
|
||||||
<ControlTemplate x:Key="TipSliderThumbHorizontalTop" TargetType="Thumb">
|
<ControlTemplate x:Key="TipSliderThumbHorizontalTop" TargetType="Thumb">
|
||||||
<hc:AxleCanvas>
|
<hc:AxleCanvas>
|
||||||
<Label Name="LabelValue" IsHitTestVisible="False" Opacity="0" Canvas.Bottom="28" Style="{StaticResource LabelPrimary}" Content="{Binding Value,RelativeSource={RelativeSource AncestorType=Slider}}" ContentStringFormat="{Binding Path=(hc:TipElement.StringFormat),RelativeSource={RelativeSource AncestorType=Slider}}" />
|
<Label Name="LabelValue" IsHitTestVisible="False" Opacity="0" Canvas.Bottom="28" Style="{StaticResource LabelPrimary}" Content="{Binding Value,RelativeSource={RelativeSource AncestorType=Slider}}" ContentStringFormat="{Binding Path=(hc:TipElement.StringFormat),RelativeSource={RelativeSource AncestorType=Slider}}" />
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ Styles\Base\ToolTipBaseStyle.xaml
|
|||||||
Styles\Base\TransferBaseStyle.xaml
|
Styles\Base\TransferBaseStyle.xaml
|
||||||
..\..\..\Net_40\HandyControl_Net_40\Themes\Styles\Base\TreeViewBaseStyle.xaml
|
..\..\..\Net_40\HandyControl_Net_40\Themes\Styles\Base\TreeViewBaseStyle.xaml
|
||||||
Styles\Base\WatermarkBaseStyle.xaml
|
Styles\Base\WatermarkBaseStyle.xaml
|
||||||
|
Styles\Base\AutoCompleteTextBoxBaseStyle.xaml
|
||||||
# --------------------------------------
|
# --------------------------------------
|
||||||
Styles\Badge.xaml
|
Styles\Badge.xaml
|
||||||
Styles\CalendarWithClock.xaml
|
Styles\CalendarWithClock.xaml
|
||||||
@@ -183,3 +184,4 @@ Styles\Transfer.xaml
|
|||||||
Styles\TransitioningContentControl.xaml
|
Styles\TransitioningContentControl.xaml
|
||||||
Styles\TreeView.xaml
|
Styles\TreeView.xaml
|
||||||
Styles\Watermark.xaml
|
Styles\Watermark.xaml
|
||||||
|
Styles\AutoCompleteTextBox.xaml
|
||||||
@@ -116,6 +116,7 @@ Styles\Base\ToolTipBaseStyle.xaml
|
|||||||
Styles\Base\TransferBaseStyle.xaml
|
Styles\Base\TransferBaseStyle.xaml
|
||||||
Styles\Base\TreeViewBaseStyle.xaml
|
Styles\Base\TreeViewBaseStyle.xaml
|
||||||
Styles\Base\WatermarkBaseStyle.xaml
|
Styles\Base\WatermarkBaseStyle.xaml
|
||||||
|
Styles\Base\AutoCompleteTextBoxBaseStyle.xaml
|
||||||
# --------------------------------------
|
# --------------------------------------
|
||||||
Styles\Badge.xaml
|
Styles\Badge.xaml
|
||||||
Styles\CalendarWithClock.xaml
|
Styles\CalendarWithClock.xaml
|
||||||
@@ -183,3 +184,4 @@ Styles\Transfer.xaml
|
|||||||
Styles\TransitioningContentControl.xaml
|
Styles\TransitioningContentControl.xaml
|
||||||
Styles\TreeView.xaml
|
Styles\TreeView.xaml
|
||||||
Styles\Watermark.xaml
|
Styles\Watermark.xaml
|
||||||
|
Styles\AutoCompleteTextBox.xaml
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace HandyControl.Tools.Helper
|
||||||
|
{
|
||||||
|
public class BindingHelper
|
||||||
|
{
|
||||||
|
public static string GetString(object source, string path)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(path))
|
||||||
|
{
|
||||||
|
return source == null ? string.Empty : source.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
var tempObj = new DependencyObject();
|
||||||
|
|
||||||
|
var binding = new Binding(path)
|
||||||
|
{
|
||||||
|
Mode = BindingMode.OneTime,
|
||||||
|
Source = source
|
||||||
|
};
|
||||||
|
|
||||||
|
BindingOperations.SetBinding(tempObj, TextSearch.TextProperty, binding);
|
||||||
|
var result = (string) tempObj.GetValue(TextSearch.TextProperty);
|
||||||
|
|
||||||
|
BindingOperations.ClearBinding(tempObj, TextSearch.TextProperty);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user