Korrekturversion ENI-2
This commit is contained in:
parent
e0a7f2654e
commit
24c9d697f0
@ -6,9 +6,7 @@ using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Data;
|
||||
using System.Linq;
|
||||
using bsmd.database;
|
||||
using ENI2.Util;
|
||||
|
||||
namespace ENI2.Controls
|
||||
{
|
||||
@ -83,44 +81,7 @@ namespace ENI2.Controls
|
||||
protected void ComboBox_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
|
||||
{
|
||||
ComboBox cmb = sender as ComboBox;
|
||||
if (cmb == null) return;
|
||||
if (cmb.ItemsSource == null) return;
|
||||
|
||||
CollectionView itemsViewOriginal = (CollectionView)CollectionViewSource.GetDefaultView(cmb.ItemsSource);
|
||||
|
||||
bool ignoreSelect = ((e.Key == System.Windows.Input.Key.Back) || (e.Key == System.Windows.Input.Key.Delete));
|
||||
|
||||
itemsViewOriginal.Filter = ((o) =>
|
||||
{
|
||||
bool result = false;
|
||||
if (String.IsNullOrEmpty(cmb.Text))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(o is System.Collections.Generic.KeyValuePair<string, string>)
|
||||
if(((System.Collections.Generic.KeyValuePair<string, string>)o).Value.StartsWith(cmb.Text, StringComparison.OrdinalIgnoreCase))
|
||||
result = true;
|
||||
if(o is System.Collections.Generic.KeyValuePair<int, string>)
|
||||
if (((System.Collections.Generic.KeyValuePair<int, string>)o).Value.StartsWith(cmb.Text, StringComparison.OrdinalIgnoreCase))
|
||||
result = true;
|
||||
if (o is string)
|
||||
if (((string)o).Contains(cmb.Text, StringComparison.OrdinalIgnoreCase)) result = true;
|
||||
}
|
||||
//System.Diagnostics.Trace.WriteLine(string.Format("{0} - {1} - {2}", o, cmb.Text, result));
|
||||
return result;
|
||||
});
|
||||
|
||||
//System.Diagnostics.Trace.WriteLine("---");
|
||||
itemsViewOriginal.Refresh();
|
||||
|
||||
if (!ignoreSelect && (itemsViewOriginal.Count == 1))
|
||||
{
|
||||
// Treffer: Select?
|
||||
cmb.SelectedItem = itemsViewOriginal.GetItemAt(0);
|
||||
}
|
||||
|
||||
GlobalStructures.FilterCombobox(cmb, e.Key);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -7,9 +7,8 @@ using System.Collections.Generic;
|
||||
using System.Windows.Controls;
|
||||
|
||||
using bsmd.database;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Data;
|
||||
using ENI2.Util;
|
||||
|
||||
namespace ENI2
|
||||
{
|
||||
@ -215,44 +214,10 @@ namespace ENI2
|
||||
|
||||
#region combobox content filtering
|
||||
|
||||
|
||||
protected void ComboBox_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
|
||||
{
|
||||
|
||||
ComboBox cmb = sender as ComboBox;
|
||||
if (cmb == null) return;
|
||||
|
||||
bool ignoreSelect = ((e.Key == System.Windows.Input.Key.Back) || (e.Key == System.Windows.Input.Key.Delete));
|
||||
|
||||
CollectionView itemsViewOriginal = (CollectionView)CollectionViewSource.GetDefaultView(cmb.ItemsSource);
|
||||
System.Diagnostics.Trace.WriteLine(cmb.Text);
|
||||
itemsViewOriginal.Filter = ((o) =>
|
||||
{
|
||||
bool result = false;
|
||||
if (String.IsNullOrEmpty(cmb.Text))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
else if (o is string)
|
||||
{
|
||||
if (((string)o).Contains(cmb.Text, StringComparison.OrdinalIgnoreCase)) result = true;
|
||||
}
|
||||
else if (o is System.Collections.Generic.KeyValuePair<string, string>)
|
||||
{
|
||||
if (((System.Collections.Generic.KeyValuePair<string, string>)o).Value.StartsWith(cmb.Text, StringComparison.OrdinalIgnoreCase))
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
});
|
||||
|
||||
itemsViewOriginal.Refresh();
|
||||
|
||||
if (!ignoreSelect && (itemsViewOriginal.Count == 1))
|
||||
{
|
||||
// Treffer: Select?
|
||||
cmb.SelectedItem = itemsViewOriginal.GetItemAt(0);
|
||||
}
|
||||
|
||||
GlobalStructures.FilterCombobox(cmb, e.Key);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -68,30 +68,25 @@
|
||||
<Label HorizontalContentAlignment="Right" Grid.Row="18" Grid.Column="2" Content="{x:Static p:Resources.textGeneralCargoDescription}" Name="label_GeneralCargoDescription" Margin="0,0,10,0"/>
|
||||
|
||||
<CheckBox Name="checkBoxKielCanalPassagePlanned" IsChecked="{Binding KielCanalPassagePlanned}" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center"/>
|
||||
<xctk:DateTimePicker Name="dateTimePickerKielCanalPassagePlannedIncomming" Grid.Row="1" Grid.Column="1" Value="{Binding KielCanalPassagePlannedIncomming}" Margin="2" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" ContextMenu="{DynamicResource ClearContextMenu}"/>
|
||||
<xctk:DateTimePicker Name="dateTimePickerKielCanalPassagePlannedOutgoing" Grid.Row="1" Grid.Column="3" Value="{Binding KielCanalPassagePlannedOutgoing}" Margin="2" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" ContextMenu="{DynamicResource ClearContextMenu}"/>
|
||||
<ComboBox Name="comboBoxCurrentShipSecurityLevel" Grid.Row="3" Grid.Column="1" SelectedValue="{Binding CurrentShipSecurityLevel}" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="False" />
|
||||
<CheckBox Name="checkBoxSECSimplification" IsChecked="{Binding SECSimplification}" Grid.Row="5" Grid.Column="1" VerticalAlignment="Center"/>
|
||||
<CheckBox Name="checkBoxValidISSCOnBoard" IsChecked="{Binding ValidISSCOnBoard}" Grid.Row="13" Grid.Column="1" VerticalAlignment="Center"/>
|
||||
<CheckBox Name="checkBoxApprovedSecurityPlanOnBoard" IsChecked="{Binding ApprovedSecurityPlanOnBoard}" Grid.Row="17" Grid.Column="1" VerticalAlignment="Center"/>
|
||||
|
||||
<enictrl:LocodeControl x:Name="locodePortOfCallWhereCompleteSECNotified" Grid.Row="6" Grid.Column="1" LocodeValue="{Binding PortOfCallWhereCompleteSECNotified}" />
|
||||
<TextBox Name="textBoxCSOFirstName" Grid.Row="8" Grid.Column="1" MaxLength="100" Text="{Binding CSOFirstName}" Margin="2" />
|
||||
<TextBox Name="textBoxCSOLastName" Grid.Row="8" Grid.Column="3" MaxLength="100" Text="{Binding CSOLastName}" Margin="2" />
|
||||
<TextBox Name="textBoxCSOPhoneName" Grid.Row="9" Grid.Column="1" MaxLength="100" Text="{Binding CSOPhone}" Margin="2" />
|
||||
<TextBox Name="textBoxCSOFaxName" Grid.Row="9" Grid.Column="3" MaxLength="100" Text="{Binding CSOFax}" Margin="2" />
|
||||
<TextBox Name="textBoxCSOEMailName" Grid.Row="10" Grid.Column="1" MaxLength="100" Text="{Binding CSOEMail}" Margin="2" />
|
||||
<CheckBox Name="checkBoxValidISSCOnBoard" IsChecked="{Binding ValidISSCOnBoard}" Grid.Row="13" Grid.Column="1" VerticalAlignment="Center"/>
|
||||
<TextBox Name="textBoxReasonsForNoValidISSC" Grid.Row="13" Grid.Column="3" MaxLength="255" Text="{Binding ReasonsForNoValidISSC}" Margin="2" />
|
||||
<TextBox Name="textBoxISSCIssuerName" Grid.Row="15" Grid.Column="3" MaxLength="100" Text="{Binding ISSCIssuerName}" Margin="2" />
|
||||
<TextBox Name="textBoxPortFacilityOfArrival" Grid.Row="18" Grid.Column="1" MaxLength="100" Text="{Binding PortFacilityOfArrival}" Margin="2" />
|
||||
|
||||
<xctk:DateTimePicker Name="dateTimePickerKielCanalPassagePlannedIncomming" Grid.Row="1" Grid.Column="1" Value="{Binding KielCanalPassagePlannedIncomming}" Margin="2" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" ContextMenu="{DynamicResource ClearContextMenu}"/>
|
||||
<xctk:DateTimePicker Name="dateTimePickerKielCanalPassagePlannedOutgoing" Grid.Row="1" Grid.Column="3" Value="{Binding KielCanalPassagePlannedOutgoing}" Margin="2" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" ContextMenu="{DynamicResource ClearContextMenu}"/>
|
||||
|
||||
<ComboBox Name="comboBoxCurrentShipSecurityLevel" Grid.Row="3" Grid.Column="1" SelectedValue="{Binding CurrentShipSecurityLevel}" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="False" />
|
||||
<ComboBox Name="comboBoxISSCType" Grid.Row="14" Grid.Column="1" SelectedIndex="{Binding ISSCType, Converter={util:ByteConverter}}" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="False"/>
|
||||
<ComboBox Name="comboBoxISSCIssuerType" Grid.Row="14" Grid.Column="3" SelectedIndex="{Binding ISSCIssuerType, Converter={util:ByteConverter}}" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="False"/>
|
||||
<ComboBox Name="comboBoxGeneralDescriptionOfCargo" Grid.Row="18" Grid.Column="3" IsEditable="True" StaysOpenOnEdit="True" SelectedIndex="{Binding GeneralDescriptionOfCargo, Converter={util:ByteConverter}}" Margin="2" IsTextSearchEnabled="False"/>
|
||||
|
||||
<DatePicker Name="datePickerISSCDateOfExpiration" Grid.Row="15" Grid.Column="1" SelectedDate="{Binding ISSCDateOfExpiration}" Margin="2" />
|
||||
|
||||
<enictrl:LocodeControl x:Name="locodePortOfCallWhereCompleteSECNotified" Grid.Row="6" Grid.Column="1" LocodeValue="{Binding PortOfCallWhereCompleteSECNotified}" />
|
||||
<TextBox Name="textBoxISSCIssuerName" Grid.Row="15" Grid.Column="3" MaxLength="100" Text="{Binding ISSCIssuerName}" Margin="2" />
|
||||
<CheckBox Name="checkBoxApprovedSecurityPlanOnBoard" IsChecked="{Binding ApprovedSecurityPlanOnBoard}" Grid.Row="17" Grid.Column="1" VerticalAlignment="Center"/>
|
||||
<TextBox Name="textBoxPortFacilityOfArrival" Grid.Row="18" Grid.Column="1" MaxLength="100" Text="{Binding PortFacilityOfArrival}" Margin="2" />
|
||||
<ComboBox Name="comboBoxGeneralDescriptionOfCargo" Grid.Row="18" Grid.Column="3" IsEditable="True" StaysOpenOnEdit="True" SelectedIndex="{Binding GeneralDescriptionOfCargo, Converter={util:ByteConverter}}" Margin="2" IsTextSearchEnabled="False"/>
|
||||
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
@ -261,6 +261,7 @@ namespace ENI2.DetailViewControls
|
||||
this.RegisterLocodeChange(this.locodePortOfCallWhereCompleteSECNotified, Message.NotificationClass.SEC);
|
||||
|
||||
this.checkBoxSECSimplification.Checked += CheckBoxSECSimplification_Checked;
|
||||
this.checkBoxSECSimplification.Unchecked += CheckBoxSECSimplification_Checked;
|
||||
this.checkBoxKielCanalPassagePlanned.Checked += CheckBoxKielCanalPassagePlanned_Checked;
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
<MinimumRequiredVersion>3.5.1.0</MinimumRequiredVersion>
|
||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||
<WebPage>publish.html</WebPage>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationRevision>1</ApplicationRevision>
|
||||
<ApplicationVersion>3.6.12.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||
|
||||
@ -38,9 +38,9 @@
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Width="auto" Name="textBoxLastName" Margin="2" MaxLength="100" />
|
||||
<TextBox Grid.Row="1" Grid.Column="3" Width="auto" Name="textBoxFirstName" Margin="2" MaxLength="100" />
|
||||
<TextBox Grid.Row="2" Grid.Column="3" Width="auto" Name="textBoxPlaceOfBirth" Margin="2" MaxLength="100" />
|
||||
<ComboBox Grid.Row="2" Grid.Column="1" Name="comboBoxGender" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="False" />
|
||||
<ComboBox Grid.Row="3" Grid.Column="1" Name="comboBoxNationality" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="False" />
|
||||
<ComboBox Grid.Row="4" Grid.Column="1" Name="comboBoxIdDocType" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="False" />
|
||||
<ComboBox Grid.Row="2" Grid.Column="1" Name="comboBoxGender" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="False" ContextMenu="{DynamicResource ClearContextMenu}"/>
|
||||
<ComboBox Grid.Row="3" Grid.Column="1" Name="comboBoxNationality" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="False" ContextMenu="{DynamicResource ClearContextMenu}"/>
|
||||
<ComboBox Grid.Row="4" Grid.Column="1" Name="comboBoxIdDocType" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="False" ContextMenu="{DynamicResource ClearContextMenu}" />
|
||||
<TextBox Grid.Row="4" Grid.Column="3" Width="auto" Name="textBoxIdDocNumber" Margin="2" MaxLength="100" />
|
||||
<DatePicker Grid.Row="3" Grid.Column="3" Name="datePickerDateOfBirth" Margin="2" />
|
||||
<TextBox Grid.Row="5" Grid.Column="1" Width="auto" Name="textBoxVisaNumber" Margin="2" MaxLength="100" />
|
||||
|
||||
@ -11,7 +11,7 @@ Copyright (c) 2017 schick Informatik
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:p="clr-namespace:ENI2.Properties"
|
||||
mc:Ignorable="d"
|
||||
Title="{x:Static p:Resources.textLadg}" Height="246" Width="800" WindowStyle="SingleBorderWindow" Background="AliceBlue">
|
||||
Title="{x:Static p:Resources.textLadg}" Height="246" Width="900" WindowStyle="SingleBorderWindow" Background="AliceBlue">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="28" />
|
||||
@ -23,7 +23,7 @@ Copyright (c) 2017 schick Informatik
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
@ -36,10 +36,10 @@ Copyright (c) 2017 schick Informatik
|
||||
<Label Name="labelPortOfDischarge" Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textCargoPortOfDischarge}" />
|
||||
<Label Name="labelCodeNST3" Grid.Row="1" Grid.Column="2" Content="{x:Static p:Resources.textCargoCodeNST3}" />
|
||||
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" Name="comboBoxHandlingType" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="False" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="3" Name="comboBoxLACodes" Margin="2" IsEditable="True" SelectedValuePath="Key" DisplayMemberPath="Value" StaysOpenOnEdit="True" IsTextSearchEnabled="False" />
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" Name="comboBoxNSTCode" Margin="2" IsEditable="True" SelectedValuePath="Key" DisplayMemberPath="Value" StaysOpenOnEdit="True" IsTextSearchEnabled="False" />
|
||||
<ComboBox Grid.Row="1" Grid.Column="3" Name="comboBoxNST3Code" Margin="2" IsEditable="True" SelectedValuePath="Key" DisplayMemberPath="Value" StaysOpenOnEdit="True" IsTextSearchEnabled="False" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" Name="comboBoxHandlingType" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="False"/>
|
||||
<ComboBox Grid.Row="0" Grid.Column="3" Name="comboBoxLACodes" Margin="2" IsEditable="True" SelectedValuePath="Key" DisplayMemberPath="Value" StaysOpenOnEdit="True" IsTextSearchEnabled="False"/>
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" Name="comboBoxNSTCode" Margin="2" IsEditable="True" SelectedValuePath="Key" DisplayMemberPath="Value" StaysOpenOnEdit="True" IsTextSearchEnabled="False"/>
|
||||
<ComboBox Grid.Row="1" Grid.Column="3" Name="comboBoxNST3Code" Margin="2" IsEditable="True" SelectedValuePath="Key" DisplayMemberPath="Value" StaysOpenOnEdit="True" IsTextSearchEnabled="False"/>
|
||||
<xctk:IntegerUpDown Grid.Row="2" Grid.Column="1" Name="integerUpDownNumberOfItems" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2,2,2,2" />
|
||||
<xctk:DoubleUpDown Grid.Row="3" Grid.Column="1" Name="doubleUpDownGrossQuantity" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2,2,2,2" FormatString="N1"/>
|
||||
<enictrl:LocodeControl Grid.Column="1" Grid.Row="4" Width="Auto" x:Name="locodeControl_PortOfLoading" />
|
||||
|
||||
@ -8,6 +8,7 @@ using System.Collections.Generic;
|
||||
using bsmd.database;
|
||||
using ENI2.Controls;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ENI2.EditControls
|
||||
{
|
||||
@ -57,12 +58,29 @@ namespace ENI2.EditControls
|
||||
this.comboBoxNSTCode.ItemsSource = LADG.CargoCodesNST;
|
||||
this.comboBoxNSTCode.KeyUp += ComboBox_KeyUp;
|
||||
this.comboBoxNSTCode.SelectedValue = this.LADG.CargoCodeNST;
|
||||
this.comboBoxNSTCode.SelectionChanged += ComboBoxNSTCode_SelectionChanged;
|
||||
|
||||
this.comboBoxNST3Code.ItemsSource = LADG.CargoCodesNST3;
|
||||
this.comboBoxNST3Code.KeyUp += ComboBox_KeyUp;
|
||||
this.comboBoxNST3Code.SelectedValue = this.LADG.CargoCodeNST_3;
|
||||
}
|
||||
|
||||
private void ComboBoxNSTCode_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
||||
{
|
||||
if (this.comboBoxNSTCode.SelectedItem == null) return;
|
||||
// filter ItemsSource von NST3
|
||||
KeyValuePair<string, string> selectedItem = (KeyValuePair < string, string> ) this.comboBoxNSTCode.SelectedItem;
|
||||
string key = selectedItem.Key;
|
||||
if (key.Length == 1) key = "0" + key;
|
||||
List<KeyValuePair<string, string>> filteredItemsSource = new List<KeyValuePair<string, string>>();
|
||||
foreach(KeyValuePair<string, string> aPair in LADG.CargoCodesNST3)
|
||||
{
|
||||
if (aPair.Value.StartsWith(key))
|
||||
filteredItemsSource.Add(aPair);
|
||||
}
|
||||
this.comboBoxNST3Code.ItemsSource = filteredItemsSource;
|
||||
}
|
||||
|
||||
private void EditLADGDialog_OKClicked()
|
||||
{
|
||||
this.LADG.CargoHandlingType = (this.comboBoxHandlingType.SelectedIndex < 0) ? null : (byte?) this.comboBoxHandlingType.SelectedIndex;
|
||||
@ -70,7 +88,7 @@ namespace ENI2.EditControls
|
||||
this.LADG.CargoGrossQuantity_TNE = this.doubleUpDownGrossQuantity.Value;
|
||||
this.LADG.PortOfLoading = this.locodeControl_PortOfLoading.LocodeValue;
|
||||
this.LADG.PortOfDischarge = this.locodeControl_PortOfDischarge.LocodeValue;
|
||||
this.LADG.CargoLACode = (int) this.comboBoxLACodes.SelectedValue;
|
||||
this.LADG.CargoLACode = (this.comboBoxLACodes.SelectedValue == null) ? null : ((int?)this.comboBoxLACodes.SelectedValue);
|
||||
this.LADG.CargoCodeNST = (string) this.comboBoxNSTCode.SelectedValue;
|
||||
this.LADG.CargoCodeNST_3 = (string)this.comboBoxNST3Code.SelectedValue;
|
||||
}
|
||||
|
||||
@ -2,8 +2,11 @@
|
||||
// Description: hier sind mehrfach verwendete Strukturen abgelegt
|
||||
//
|
||||
|
||||
using bsmd.database;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ENI2.Util
|
||||
{
|
||||
@ -98,5 +101,53 @@ namespace ENI2.Util
|
||||
return false; // value-type
|
||||
}
|
||||
|
||||
internal static void FilterCombobox(ComboBox cmb, System.Windows.Input.Key key)
|
||||
{
|
||||
if (cmb == null) return;
|
||||
if (cmb.ItemsSource == null) return;
|
||||
|
||||
bool ignoreSelect = ((key == System.Windows.Input.Key.Back) || (key == System.Windows.Input.Key.Delete));
|
||||
|
||||
CollectionView itemsViewOriginal = (CollectionView)CollectionViewSource.GetDefaultView(cmb.ItemsSource);
|
||||
System.Diagnostics.Trace.WriteLine(cmb.Text);
|
||||
if (ignoreSelect)
|
||||
{
|
||||
itemsViewOriginal.Filter = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemsViewOriginal.Filter = ((o) =>
|
||||
{
|
||||
bool result = false;
|
||||
if (String.IsNullOrEmpty(cmb.Text))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
else if (o is string)
|
||||
{
|
||||
if (((string)o).Contains(cmb.Text, StringComparison.OrdinalIgnoreCase)) result = true;
|
||||
}
|
||||
else if (o is System.Collections.Generic.KeyValuePair<string, string>)
|
||||
{
|
||||
if (((System.Collections.Generic.KeyValuePair<string, string>)o).Value.StartsWith(cmb.Text, StringComparison.OrdinalIgnoreCase))
|
||||
result = true;
|
||||
}
|
||||
else if (o is System.Collections.Generic.KeyValuePair<int, string>)
|
||||
{
|
||||
if (((System.Collections.Generic.KeyValuePair<int, string>)o).Value.StartsWith(cmb.Text, StringComparison.OrdinalIgnoreCase))
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
itemsViewOriginal.Refresh();
|
||||
|
||||
if (!ignoreSelect && (itemsViewOriginal.Count == 1))
|
||||
{
|
||||
// Treffer: Select?
|
||||
cmb.SelectedItem = itemsViewOriginal.GetItemAt(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user