Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
125
EditorButton embedded in UltraFormattedTextEditor embeded in UltraGridCell, text value won't change at runtime
posted

I'm at my whits end with this one.  I can not get this to work.  I have a WinGrid (v2012.2).  In two columns on each row I have an UltraFormattedTextEitor.  Embedded in the editor is a single EditorButton in the LeftButtons group.  

I want to be able to change the text and styling of the button at runtime depending on user behavior.  I have the code, if you trace it, it shows the text value changing, but the display does not change.  

A sample is below.  Any help would be appreciated!!!

Imports Infragistics.Win
Imports Infragistics.Win.AppStyling
Imports Infragistics.Win.UltraWinGrid
Imports Infragistics.Win.UltraWinEditors
Imports Infragistics.Win.UltraWinDataSource
Imports Infragistics.Win.FormattedLinkLabel

Public Class Form3
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Call InitializeWebGrid()
Call AddRowToBand("Root", "Test Cell")
End Sub
Private Sub InitializeWebGrid()
With UltraGrid1
Call .ResetDisplayLayout()
Call .ResetLayouts()
.DataSource = InitializeDataSource()
With .DisplayLayout
.UseFixedHeaders = False
.Scrollbars = Scrollbars.Automatic
.AutoFitStyle = AutoFitStyle.None
With .Override
.HeaderClickAction = HeaderClickAction.SortSingle
.AllowColMoving = AllowColMoving.NotAllowed
.AllowColSizing = AllowColSizing.None
.AllowColSwapping = AllowColSwapping.NotAllowed
.FixedRowIndicator = FixedRowIndicator.None
.MergedCellStyle = MergedCellStyle.Never
.RowSelectors = DefaultableBoolean.False
.SelectTypeCell = SelectType.None
.SelectTypeCol = SelectType.None
.SelectTypeRow = SelectType.None
.SupportDataErrorInfo = SupportDataErrorInfo.None
.TipStyleScroll = TipStyle.Hide
.RowSizing = RowSizing.Free
End With
End With
End With
End Sub
Private Function InitializeDataSource() As UltraDataSource
Dim strRoot As String = "Root"
Dim objDataSource = New UltraDataSource
With objDataSource
Call .Reset()
.Band.Key = strRoot
End With
Call FormatBand(objDataSource.GetBandByKey(strRoot))
Return objDataSource
End Function
Private Sub FormatBand(ByRef pobjDataBand As UltraDataBand)
With pobjDataBand
.AllowAdd = DefaultableBoolean.True
.ReadOnly = DefaultableBoolean.False
.Columns.Add("Column1", GetType(System.String))
End With
End Sub
Private Function AddRowToBand(ByVal pstrBand As String, ByVal pstrText As String) As UltraGridRow
Dim objRow As UltraGridRow = UltraGrid1.DisplayLayout.Bands(pstrBand).AddNew()
With objRow
With .Band.Columns("Column1")
.Width = 250
.CellActivation = Activation.AllowEdit
.CellAppearance.TextHAlign = HAlign.Left
.ButtonDisplayStyle = UltraWinGrid.ButtonDisplayStyle.Always
End With

With .Cells("Column1")
.CellDisplayStyle = CellDisplayStyle.FullEditorDisplay
.Style = ColumnStyle.FormattedTextEditor
.Activation = Activation.AllowEdit
.EditorComponent = Initialize_UltraFormattedTextEditor()
Call .SetValue(pstrText, False)
End With
End With
Return objRow
End Function
Private Function Initialize_UltraFormattedTextEditor() As UltraFormattedTextEditor
Dim objEditor As New UltraFormattedTextEditor
With objEditor
Call .ButtonsLeft.Clear()
.ScrollBarDisplayStyle = UltraWinScrollBar.ScrollBarDisplayStyle.Never
.ButtonsLeft.Add(Initialize_EditorButton)
End With
Return objEditor
End Function
Private Function Initialize_EditorButton() As EditorButton
Dim objButton As New EditorButton
With objButton
.Text = "?"
.Width = 18
.Enabled = True
.Appearance.TextHAlign = HAlign.Center
.Key = "Remove"
End With
Return objButton
End Function

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
CType(CType(UltraGrid1.Rows(0).Cells(0).EditorComponent, UltraFormattedTextEditor).ButtonsLeft(0), EditorButton).Text = "#"
End Sub
End Class