Skip to main content

TokenEdit.SelectedValues Property

Gets or sets the selected items by their values. The ValueMember property specifies the data member that contains token values. This is a bindable property.

Namespace: DevExpress.Maui.Editors

Assembly: DevExpress.Maui.Editors.dll

NuGet Package: DevExpress.Maui.Editors

Declaration

public IList SelectedValues { get; set; }

Property Value

Type Description
IList

A list of token values.

Remarks

Use values that the ValueMember supplies to define the selected items by their values.

You can also use the SelectedIndexes and SelectedItems properties to specify the selected items in a TokenEdit.

Refer to the following section for more information about selection in the TokenEdit control: Manage Selected Items.

Example

The example below uses item values to specify items selected in a token editor:

<ContentPage.BindingContext>
    <local:ViewModel/>
</ContentPage.BindingContext>
<ScrollView>
    <VerticalStackLayout Spacing="25" Padding="30,0" VerticalOptions="Start">
        <dxe:TokenEdit ItemsSource="{Binding ItemsSource}"
                       SelectedValues="{Binding SelectedValues}"
                       DisplayMember="Name"
                       ValueMember="Location"
                       WidthRequest="400"/>
    </VerticalStackLayout>
</ScrollView>
public class ViewModel {
    public ViewModel() {
        ItemsSource = new ObservableCollection<Person>() {
                new Person {Name = "Devin", Age = 50, Location = "Atlanta"},
                new Person {Name = "Brenda", Age = 25, Location = "Memphis"},
                new Person {Name = "Sean", Age = 36, Location = "Houston"}
        };
        SelectedValues = new ObservableCollection<string> { "Atlanta", "Houston" };
    }
    public ObservableCollection<Person> ItemsSource { get; }
    public ObservableCollection<string> SelectedValues { get; }
}

public class Person {
    public string Name { get; set; }
    public int Age { get; set; }
    public string Location { get; set; }
}
See Also