Back to Devexpress

HighlightedMemberAttribute Class

corelibraries-devexpress-dot-dataaccess-dot-objectbinding-986259bc.md

latest3.7 KB
Original Source

HighlightedMemberAttribute Class

When applied to a data source member, includes the corresponding item in the list of highlighted data members in the Data Source Wizard.

Namespace : DevExpress.DataAccess.ObjectBinding

Assembly : DevExpress.DataAccess.v25.2.dll

NuGet Package : DevExpress.DataAccess

Declaration

csharp
[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
public sealed class HighlightedMemberAttribute :
    Attribute
vb
<AttributeUsage(AttributeTargets.Constructor Or AttributeTargets.Method Or AttributeTargets.Property, AllowMultiple:=False, Inherited:=False)>
Public NotInheritable Class HighlightedMemberAttribute
    Inherits Attribute

Example

To highlight a specific class or data member in an ObjectDataSource, use the HighlightedClassAttribute and HighlightedMemberAttribute.

This requires adding a reference to the DevExpress.DataAccess.ObjectBinding namespace that resides within the DevExpress.DataAccess assembly.

In the Reference Manager that is invoked, switch to the Extensions tab, select the appropriate version of the DevExpress.DataAccess assembly and click OK.

The following code illustrates the use of these attributes in the data source class definition.

csharp
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using DevExpress.DataAccess.ObjectBinding;
// ...

[DisplayName("Fishes")]
[HighlightedClass]
public class Fishes : List<Fish> {
    [HighlightedMember]
    public Fishes(string filePath) {
        if(File.Exists(filePath)) {
            using(Stream stream = File.OpenRead(filePath)) {
                this.LoadFrom(stream);
            }
        }
    }
// ...
}
vb
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.IO
Imports DevExpress.DataAccess.ObjectBinding
' ...

<DisplayName("Fishes"), HighlightedClass> _
Public Class Fishes
    Inherits List(Of Fish)
    <HighlightedMember> _
    Public Sub New(ByVal filePath As String)
        If File.Exists(filePath) Then
            Using stream As Stream = File.OpenRead(filePath)
                Me.LoadFrom(stream)
            End Using
        End If
    End Sub
' ...
End Class

Inheritance

Object Attribute HighlightedMemberAttribute

See Also

HighlightedMemberAttribute Members

HighlightedAssemblyAttribute

HighlightedClassAttribute

DevExpress.DataAccess.ObjectBinding Namespace