ItemsControl.IsTextSearchCaseSensitive 屬性

定義

取得或設定值,其表示在搜尋項目時,大小寫是否也是條件之一。

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

屬性值

如果文字搜尋區分大小寫則為 true,否則為 false

範例

下列範例會建立包含 ComboBox 字串 「DOG」、「CAT」、「dog」 和 「cat」 的 。 此範例會將 IsTextSearchCaseSensitive 屬性系結至 IsCheckedCheckBox 屬性。 如果選取核取方塊,且使用者輸入 「dog」,則會選取 中的 ItemsControl 第三個專案。 如果使用者取消選取核取方塊並輸入 「dog」,則會選取第一個專案,因為案例不是搜尋的條件。

<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 屬性會指定案例是否決定是否在 中 ItemsControl 選取專案。 例如,如果 只包含兩個 ItemsControl 只在案例中不同的字串,例如 「ITEM」 和 「item」,則不論輸入的大小寫為何,一律會選取第一個字串。

適用於