64 lines
2.7 KiB
VB.net
64 lines
2.7 KiB
VB.net
' Developer Express Code Central Example:
|
|
' How to create a PropertyEditor based on the XtraRichEdit control
|
|
'
|
|
' Take special note that this editor is intended to be used for a simple and most
|
|
' common scenario when only one text property in a Detail View is edited with the
|
|
' help of the XtraRichEdit control. Other scenarios are not supported in this
|
|
' example and are required to be implemented manually. For example, if there are
|
|
' more than one property, edited with this editor in a Detail View, then there may
|
|
' be problems with merging in ribbons. See the issue for more detailed
|
|
' information. See Also: Implement Custom Property Editors How to: Implement a
|
|
' Property Editor for Windows Forms Applications XtraRichEdit Home
|
|
'
|
|
' You can find sample updates and versions for different programming languages here:
|
|
' http://www.devexpress.com/example=E1509
|
|
|
|
Imports Microsoft.VisualBasic
|
|
Imports System
|
|
Imports DevExpress.ExpressApp.Win.Editors
|
|
Imports DevExpress.ExpressApp.Model
|
|
Imports DevExpress.Xpo
|
|
Imports DevExpress.ExpressApp
|
|
Imports DevExpress.ExpressApp.Editors
|
|
|
|
<PropertyEditor(GetType([String]), False)> _
|
|
Public Class RichEditPropertyEditor
|
|
Inherits WinPropertyEditor
|
|
Public Sub New(ByVal objectType As Type, ByVal info As IModelMemberViewItem)
|
|
MyBase.New(objectType, info)
|
|
ControlBindingProperty = "RtfText"
|
|
End Sub
|
|
Private richEditUserControlCore As RichEditUserControl = Nothing
|
|
Public ReadOnly Property RichEditUserControl() As RichEditUserControl
|
|
Get
|
|
Return richEditUserControlCore
|
|
End Get
|
|
End Property
|
|
Protected Overrides Function CreateControlCore() As Object
|
|
richEditUserControlCore = New RichEditUserControl()
|
|
AddHandler richEditUserControlCore.RichEditControl.RtfTextChanged, AddressOf RichEditControl_RtfTextChanged
|
|
UpdateReadOnly()
|
|
Return richEditUserControlCore
|
|
End Function
|
|
Protected Overrides Sub OnAllowEditChanged()
|
|
MyBase.OnAllowEditChanged()
|
|
UpdateReadOnly()
|
|
End Sub
|
|
Private Sub UpdateReadOnly()
|
|
'Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
'Dim _Customers_Collection As New XPCollection(Of Customers)(_ocur.Session)
|
|
'If RichEditUserControl IsNot Nothing AndAlso RichEditUserControl.RichEditControl IsNot Nothing Then
|
|
|
|
' RichEditUserControl.RichEditControl.ReadOnly = Not AllowEdit
|
|
' 'RichEditUserControl.RichEditControl.Options.MailMerge.DataSource = _Customers_Collection
|
|
'End If
|
|
End Sub
|
|
|
|
Private Sub RichEditControl_RtfTextChanged(sender As Object, e As EventArgs)
|
|
'Me.PropertyValue = Me.RichEditUserControl.RichEditControl.RtfText
|
|
OnControlValueChanged()
|
|
End Sub
|
|
|
|
End Class
|
|
|