ItemsControl.IsTextSearchCaseSensitive 屬性

定義

取得或設定值,其表示在搜尋項目時,大小寫是否也是條件之一。Gets or sets a value that indicates whether case is a condition when searching for items.

public:
 property bool IsTextSearchCaseSensitive { bool get(); void set(bool value); };
public bool IsTextSearchCaseSensitive { get; set; }
member this.IsTextSearchCaseSensitive : bool with get, set
Public Property IsTextSearchCaseSensitive As Boolean

屬性值

Boolean

如果文字搜尋區分大小寫則為 true,否則為 falsetrue if text searches are case-sensitive; otherwise, false.

範例

下列範例 ComboBox 會建立,其中包含字串、"dog"、"貓"、"dog" 和 "貓"。The following example creates a ComboBox that contains the strings, "DOG", "CAT", "dog", and "cat". 此範例會將 IsTextSearchCaseSensitive 屬性系結至的 IsChecked 屬性 CheckBoxThe example binds the IsTextSearchCaseSensitive property to the IsChecked property of a CheckBox. 如果選取此核取方塊,且使用者輸入 "dog",則會選取中的第三個專案 ItemsControlIf the check box is selected and the user types "dog", the third item in the ItemsControl is selected. 如果使用者取消選取此核取方塊並輸入 "dog",則會選取第一個專案,因為大小寫不是搜尋的條件。If the user unselects the check box and types "dog", the first item is selected because case is not a condition of the search.

<StackPanel>
  
  <CheckBox Content="_Case sensitive Search" IsChecked="True"
            Name="caseSensitiveSearch"/>

  <ComboBox IsEditable="True"
            IsTextSearchCaseSensitive="{Binding 
              ElementName=caseSensitiveSearch, 
              Path=IsChecked}">
    <ComboBoxItem>DOG</ComboBoxItem>
    <ComboBoxItem>CAT</ComboBoxItem>
    <ComboBoxItem>dog</ComboBoxItem>
    <ComboBoxItem>cat</ComboBoxItem>
  </ComboBox>
</StackPanel>

備註

IsTextSearchEnabled 屬性設定為時 true ,屬性會 IsTextSearchCaseSensitive 指定案例是否要判斷中是否已選取專案 ItemsControlWhen the IsTextSearchEnabled property is set to true, the IsTextSearchCaseSensitive property specifies whether the case determines whether an item is selected in an ItemsControl. 例如,如果 ItemsControl 包含兩個只有大小寫不同的字串(例如 "item" 和 "item"),則不論輸入的大小寫為何,一律會選取第一個字串。For example, if an ItemsControl contain two strings that differ only in case, such as "ITEM" and "item", the first string will always be selected, regardless of the case of the input.

適用於