Back to Devexpress

HighlightedClassAttribute Class

corelibraries-devexpress-dot-dataaccess-dot-objectbinding-fe271a33.md

latest3.5 KB
Original Source

HighlightedClassAttribute Class

When applied to a class, includes the corresponding item in the list of highlighted classes in the Data Source Wizard.

Namespace : DevExpress.DataAccess.ObjectBinding

Assembly : DevExpress.DataAccess.v25.2.dll

NuGet Package : DevExpress.DataAccess

Declaration

csharp
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class HighlightedClassAttribute :
    Attribute
vb
<AttributeUsage(AttributeTargets.Class, AllowMultiple:=False, Inherited:=False)>
Public NotInheritable Class HighlightedClassAttribute
    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 HighlightedClassAttribute

See Also

HighlightedClassAttribute Members

HighlightedAssemblyAttribute

HighlightedMemberAttribute

DevExpress.DataAccess.ObjectBinding Namespace