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

 

Parents
  • 469350
    Offline posted

    Hi,

    jnabors said:
    I'm at my whits end with this one.

    Well... the good news is, it's not you. :)

    I've tried everything I can think of to get the text to change and I can't get it to work, either. It looks like the UIElement must be caching the text and nothing I do seems to get it to update itself once it's stored. I even tried setting the EditorComponent on the cell to null and then back to the FormattedTextEditor and it still doesn't work.

    I'm going to forward this over to Infragistics Developer Support and ask them to create a case for you and enter this as a bug for developer review so we can see what's going on here and get it fixed, or at least find you a reasonable workaround.

Reply Children