แก้ไข

แชร์ผ่าน


ItemsControl.IsTextSearchCaseSensitive Property

Definition

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

Property Value

true if text searches are case-sensitive; otherwise, false.

Examples

The following example creates a ComboBox that contains the strings, "DOG", "CAT", "dog", and "cat". The example binds the IsTextSearchCaseSensitive property to the IsChecked property of a CheckBox. If the check box is selected and the user types "dog", the third item in the ItemsControl is selected. 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>

Remarks

When the IsTextSearchEnabled property is set to true, the IsTextSearchCaseSensitive property specifies whether the case determines whether an item is selected in an ItemsControl. 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.

Applies to