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

属性值

如果文本搜索区分大小写,则为 true;否则为 falsetrue if text searches are case-sensitive; otherwise, false.

示例

下面的示例创建一个包含字符串 "DOG"、"CAT"、"dog" 和 "cat" 的 ComboBoxThe following example creates a ComboBox that contains the strings, "DOG", "CAT", "dog", and "cat". 该示例将 IsTextSearchCaseSensitive 属性绑定到 CheckBoxIsChecked 属性。The example binds the IsTextSearchCaseSensitive property to the IsChecked property of a CheckBox. 如果选中此复选框,并且用户键入 "dog",则将选择 ItemsControl 中的第三项。If 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 属性指定是否在 ItemsControl中选择某一项。When 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.

适用于