serhio
serhio

Reputation: 28586

Some IBindableComponent interface implementation issues

I need to implement the IBindableComponent to the the following code:

Public Class InfragisticsToolStripBindableButton
  Inherits Infragistics.Win.UltraWinToolbars.ButtonTool
  Implements IBindableComponent

  Private _DataBindings As ControlBindingsCollection
  Private _BindingContext As BindingContext

  Public Event Disposed As EventHandler Implements IBindableComponent.Disposed

  Sub New()
    MyBase.New(String.Empty)
  End Sub

  Public ReadOnly Property DataBindings() As ControlBindingsCollection
    Get
      If _DataBindings Is Nothing Then
        _DataBindings = New ControlBindingsCollection(Me)
      End If
      Return _DataBindings
    End Get
  End Property

  Public Property BindingContext() As BindingContext
    Get
      If _BindingContext Is Nothing Then
        _BindingContext = New BindingContext()
      End If
      Return _BindingContext
    End Get
    Set(ByVal value As BindingContext)
      _BindingContext = value
    End Set
  End Property

  Public Overloads Sub Dispose()
    '???????? include bellow code '
    RaiseEvent Disposed(Me, EventArgs.Empty)
  End Sub

  'Protected Overrides Sub Dispose(ByVal disposing As Boolean)
  '  If disposing Then
  '    If _DataBindings IsNot Nothing Then
  '      _DataBindings.Clear()
  '      _DataBindings = Nothing
  '    End If
  '    _BindingContext = Nothing
  '  End If
  '  MyBase.Dispose(disposing)
  'End Sub
End Class

1 problem:
Warning: event 'Disposed' conflicts with property 'Disposed' in the base class 'DisposableObject' and should be declared 'Shadows'

2 problem:
Error: Class 'InfragisticsToolStripBindableButton' must implement 'Property Site As ISite' for interface 'System.ComponentModel.IComponent'. Implementing property must have matching 'ReadOnly' or 'WriteOnly' specifiers.

Why should I implement "IComponent" if I implement "IBindableComponent"??

3 problem:
How should I override "Dispose", if it's already implemented in the base class, but is not virtual apparently.

Upvotes: 1

Views: 783

Answers (1)

Aditya Om
Aditya Om

Reputation: 206

You are able to name Disposed any name, it does not need the same as the interface.

 Public Event StripDisposed As EventHandler Implements IBindableComponent.Disposed

see how it remains implemnts IBindableComponent.Disposed.

Upvotes: 3

Related Questions