In This Article

BarComboBoxViewModel Class

Represents a view model for a combobox control within a bar control.

public class BarComboBoxViewModel : BarGalleryViewModel, INotifyPropertyChanged, IHasKey, IHasVariantImages
Inheritance:
System.Object ObservableObjectBase BarKeyedObjectViewModelBase BarGalleryViewModelBase BarGalleryViewModel Object
Implements:
IHasKey IHasVariantImages

Constructors

BarComboBoxViewModel()

Initializes a new instance of the class.

public BarComboBoxViewModel()

BarComboBoxViewModel(String)

Initializes a new instance of the class with the specified key. The label and key tip text are auto-generated.

public BarComboBoxViewModel(string key)
Parameter Type Description
key System.String

A string that uniquely identifies the control.

BarComboBoxViewModel(String, IEnumerable)

Initializes a new instance of the class with the specified key and items. The label and key tip text are auto-generated.

public BarComboBoxViewModel(string key, IEnumerable items)
Parameter Type Description
key System.String

A string that uniquely identifies the control.

items System.Collections.IEnumerable

The collection of gallery items, where the items are typically of type IBarGalleryItemViewModel.

BarComboBoxViewModel(String, String)

Initializes a new instance of the class with the specified key and label. The key tip text is auto-generated.

public BarComboBoxViewModel(string key, string label)
Parameter Type Description
key System.String

A string that uniquely identifies the control.

label System.String

The text label to display, which is auto-generated from the key if null.

BarComboBoxViewModel(String, String, IEnumerable)

Initializes a new instance of the class with the specified key, label, and items. The key tip text is auto-generated.

public BarComboBoxViewModel(string key, string label, IEnumerable items)
Parameter Type Description
key System.String

A string that uniquely identifies the control.

label System.String

The text label to display, which is auto-generated from the key if null.

items System.Collections.IEnumerable

The collection of gallery items, where the items are typically of type IBarGalleryItemViewModel.

BarComboBoxViewModel(String, String, String)

Initializes a new instance of the class with the specified key, label, and key tip text.

public BarComboBoxViewModel(string key, string label, string keyTipText)
Parameter Type Description
key System.String

A string that uniquely identifies the control.

label System.String

The text label to display, which is auto-generated from the key if null.

keyTipText System.String

The key tip text, which is auto-generated from the label if null.

BarComboBoxViewModel(String, String, String, IEnumerable)

Initializes a new instance of the class with the specified key, label, key tip text, and items.

public BarComboBoxViewModel(string key, string label, string keyTipText, IEnumerable items)
Parameter Type Description
key System.String

A string that uniquely identifies the control.

label System.String

The text label to display, which is auto-generated from the key if null.

keyTipText System.String

The key tip text, which is auto-generated from the label if null.

items System.Collections.IEnumerable

The collection of gallery items, where the items are typically of type IBarGalleryItemViewModel.

BarComboBoxViewModel(String, String, String, ICommand)

Initializes a new instance of the class with the specified key, label, key tip text, and command.

public BarComboBoxViewModel(string key, string label, string keyTipText, ICommand command)
Parameter Type Description
key System.String

A string that uniquely identifies the control.

label System.String

The text label to display, which is auto-generated from the command or key if null.

keyTipText System.String

The key tip text, which is auto-generated from the command or label if null.

command System.Windows.Input.ICommand

The command to attach to the control.

BarComboBoxViewModel(String, String, String, ICommand, IEnumerable)

Initializes a new instance of the class with the specified key, label, key tip text, command, and items.

public BarComboBoxViewModel(string key, string label, string keyTipText, ICommand command, IEnumerable items)
Parameter Type Description
key System.String

A string that uniquely identifies the control.

label System.String

The text label to display, which is auto-generated from the command or key if null.

keyTipText System.String

The key tip text, which is auto-generated from the command or label if null.

command System.Windows.Input.ICommand

The command to attach to the control.

items System.Collections.IEnumerable

The collection of gallery items, where the items are typically of type IBarGalleryItemViewModel.

BarComboBoxViewModel(String, String, ICommand)

Initializes a new instance of the class with the specified key, label, and command. The key tip text is auto-generated.

public BarComboBoxViewModel(string key, string label, ICommand command)
Parameter Type Description
key System.String

A string that uniquely identifies the control.

label System.String

The text label to display, which is auto-generated from the command or key if null.

command System.Windows.Input.ICommand

The command to attach to the control.

BarComboBoxViewModel(String, String, ICommand, IEnumerable)

Initializes a new instance of the class with the specified key, label, command, and items. The key tip text is auto-generated.

public BarComboBoxViewModel(string key, string label, ICommand command, IEnumerable items)
Parameter Type Description
key System.String

A string that uniquely identifies the control.

label System.String

The text label to display, which is auto-generated from the command or key if null.

command System.Windows.Input.ICommand

The command to attach to the control.

items System.Collections.IEnumerable

The collection of gallery items, where the items are typically of type IBarGalleryItemViewModel.

BarComboBoxViewModel(String, ICommand)

Initializes a new instance of the class with the specified key and command. The label and key tip text are auto-generated.

public BarComboBoxViewModel(string key, ICommand command)
Parameter Type Description
key System.String

A string that uniquely identifies the control.

command System.Windows.Input.ICommand

The command to attach to the control.

BarComboBoxViewModel(String, ICommand, IEnumerable)

Initializes a new instance of the class with the specified key, command, and items. The label and key tip text are auto-generated.

public BarComboBoxViewModel(string key, ICommand command, IEnumerable items)
Parameter Type Description
key System.String

A string that uniquely identifies the control.

command System.Windows.Input.ICommand

The command to attach to the control.

items System.Collections.IEnumerable

The collection of gallery items, where the items are typically of type IBarGalleryItemViewModel.

BarComboBoxViewModel(RoutedCommand)

Initializes a new instance of the class with the specified System.Windows.Input.RoutedCommand, also used to auto-generate a key, label, and key tip text.

public BarComboBoxViewModel(RoutedCommand routedCommand)
Parameter Type Description
routedCommand System.Windows.Input.RoutedCommand

The command to attach to the control.

BarComboBoxViewModel(RoutedCommand, IEnumerable)

Initializes a new instance of the class with the specified items and System.Windows.Input.RoutedCommand, also used to auto-generate a key, label, and key tip text.

public BarComboBoxViewModel(RoutedCommand routedCommand, IEnumerable items)
Parameter Type Description
routedCommand System.Windows.Input.RoutedCommand

The command to attach to the control.

items System.Collections.IEnumerable

The collection of gallery items, where the items are typically of type IBarGalleryItemViewModel.

Properties

Description

Gets or sets the text description to display in screen tips.

public string Description { get; set; }

Property Value

System.String:

The text description to display in screen tips.

IsEditable

Gets or sets whether the combobox is editable.

public bool IsEditable { get; set; }

Property Value

System.Boolean:

true if the combobox is editable; otherwise, false. The default value is false.

IsPreviewEnabledWhenPopupClosed

Gets or sets whether an editable combobox will preview a gallery item if the item is matched by typed text while the popup is closed.

public bool IsPreviewEnabledWhenPopupClosed { get; set; }

Property Value

System.Boolean:

true if an editable combobox will preview a gallery item if the item is matched by typed text while the popup is closed; otherwise, false. The default value is false.

IsReadOnly

Gets or sets whether the combobox is read-only.

public bool IsReadOnly { get; set; }

Property Value

System.Boolean:

true if the combobox is read-only; otherwise, false. The default value is false.

IsStarSizingAllowed

Gets or sets whether the control can star-size and fill available space when appropriate.

public bool IsStarSizingAllowed { get; set; }

Property Value

System.Boolean:

true if the control can star-size; otherwise, false. The default value is false.

IsTextCompletionEnabled

Gets or sets whether the control will attempt to complete typed text with a matching item.

public bool IsTextCompletionEnabled { get; set; }

Property Value

System.Boolean:

true if the control will attempt to complete typed text with a matching item; otherwise, false. The default value is true.

IsTextSearchCaseSensitive

Gets or sets whether case is a condition when searching for items.

public bool IsTextSearchCaseSensitive { get; set; }

Property Value

System.Boolean:

true if text searches are case-sensitive; otherwise false. The default value is false.

See Also

IsTextSearchEnabled

Gets or sets whether known items are matched when text is entered.

public bool IsTextSearchEnabled { get; set; }

Property Value

System.Boolean:

true if items are matched when text is entered; otherwise false. The default value is true.

See Also

IsUnmatchedTextAllowed

Gets or sets whether committed Text that is unable to be matched to a gallery item will raise the UnmatchedTextCommand and possibly be allowed.

public bool IsUnmatchedTextAllowed { get; set; }

Property Value

System.Boolean:

true if committed Text that is unable to be matched to a gallery item will raise the UnmatchedTextCommand and possibly be allowed; otherwise, false. The default value is true.

See Also

MaxPopupHeight

Gets or sets the maximum popup height.

public double MaxPopupHeight { get; set; }

Property Value

System.Double:

The maximum popup height. The default value is Double.PositiveInfinity.

PlaceholderText

Gets or sets the placeholder text to display when the control is empty.

public string PlaceholderText { get; set; }

Property Value

System.String:

The placeholder text to display when the control is empty.

RequestedWidth

Gets or sets the requested width of the control.

public double RequestedWidth { get; set; }

Property Value

System.Double:

The requested width of the control. The default value is 110.

Text

Gets or sets the text to display in the control.

public string Text { get; set; }

Property Value

System.String:

The text to display in the control.

TextPath

Gets or sets the path to a string gallery item property, corresponding to Text display and entry.

public string TextPath { get; set; }

Property Value

System.String:

The path to a string gallery item property, corresponding to Text display and entry.

UnmatchedTextCommand

Gets or sets the System.Windows.Input.ICommand to execute when Text is committed that is unable to be matched to a gallery item or when IsTextSearchEnabled is false.

public ICommand UnmatchedTextCommand { get; set; }

Property Value

System.Windows.Input.ICommand:

The System.Windows.Input.ICommand to execute when Text is committed that is unable to be matched to a gallery item or when IsTextSearchEnabled is false.

Remarks

This command is only used when the IsUnmatchedTextAllowed property is true. The unmatched text string is passed as a command parameter.

When the command is null or CanExecute(Object) returns true, the text will be committed; otherwise, it will not be committed.

See Also

Methods

SelectItemByTextMatch<T>(Func<T, String>, String)

Selects an item in the gallery whose text representation matches the specified text,

public virtual void SelectItemByTextMatch<T>(Func<T, string> getItemTextFunc, string text)
    where T : IBarGalleryItemViewModel
Type Parameters:
T -

The type of IBarGalleryItemViewModel to examine.

Parameter Type Description
getItemTextFunc System.Func<T, System.String>

A function that examines an item and returns its string value for comparison to text.

text System.String

The text for which to search and that will be set to Text.

SelectItemByValueMatch<T>(Func<T, Boolean>, Func<T, String>, String)

Selects an item in the gallery that matches the predicate, alternatively setting the specified fallback Text if no match is made.

public virtual void SelectItemByValueMatch<T>(Func<T, bool> matchPredicate, Func<T, string> getMatchedItemTextFunc, string fallbackText)
    where T : IBarGalleryItemViewModel
Type Parameters:
T -

The type of IBarGalleryItemViewModel to examine.

Parameter Type Description
matchPredicate System.Func<T, System.Boolean>

A predicate that determines when an item matches criteria.

getMatchedItemTextFunc System.Func<T, System.String>

A function that examines a matched item and returns the string value to set to Text.

fallbackText System.String

The fallback text to set to Text when there is no match.

Inherited Members