Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TokenEdit.IconMember Property

Gets or sets the data source member that contains token icons. This is a bindable property.

Namespace: DevExpress.Maui.Editors

Assembly: DevExpress.Maui.Editors.dll

NuGet Package: DevExpress.Maui.Editors

#Declaration

C#
public string IconMember { get; set; }

#Property Value

Type Description
String

The name of the data source field.

#Example

The following example configures the appearance of token icons and token outline:

DevExpress TokenEdit for MAUI -- Customize token appearance

<ContentPage.BindingContext>
    <local:ViewModel />
</ContentPage.BindingContext>

<dxe:TokenEdit x:Name="tokenEdit" WidthRequest="400" 
               LabelText="Color" 
               ItemsSource="{Binding ItemsSource}"
               ClearIconVisibility="Always"
               DisplayMember="ColorName"
               IconMember="ColorSampleIcon" 
               IsTokenIconVisible="True">
    <dxe:TokenEdit.TokenAppearance>
        <dxe:TokenAppearance BorderColor="CornflowerBlue" 
                             BorderThickness="2"
                             CornerRadius="14"
                             FontFamily="Univia-Pro"
                             FontSize="14" />
    </dxe:TokenEdit.TokenAppearance>
</dxe:TokenEdit>
C#
public class ViewModel {
    public ViewModel() {
        ItemsSource = new List<ColorInfo> {
            new ColorInfo("Black","#000000"),
            new ColorInfo("White","#ffffff"),
            new ColorInfo("Gray", "#e5e5e5"),
            new ColorInfo("Blue", "#0000ff"),
            new ColorInfo("Green", "#00ff00")
        };
    }
    public IList<ColorInfo> ItemsSource { get; }
}

public class ColorInfo {
    public string ColorName { get; set; }
    public ImageSource ColorSampleIcon { get; set; }
    public ColorInfo(string name, string color) {
        ColorName = name;
        ColorSampleIcon = new FontImageSource() { Glyph = $"{name[0]}", Color = Color.FromArgb(color) };
    }
}
See Also