Finding Filtered Rows In The UltraWinGrid.RowsCollection

infragistics_logo

October 3, 2013 | Posted in Infragistics

Need to find out how many rows have been filtered having applied a column filter?

UltraWinGrid.RowsCollection.FilteredInRowCount()

Simply query the above property which will tell you how many rows there are as a result of the filter.

Hook in to the AfterRowFilterChanged event to perform the required action having changed the filter.

Read More →

How To Format The UltraFormattedTextEditor Value Using FormattedTextUIEditorForm

infragistics_logo

October 3, 2013 | Posted in Infragistics

The use and displaying of correctly formatted text in the UltraFormattedTextEditor Infragistics control is somewhat cumbersome, especially when you are dealing with some formatted text that somebody happened to copy and paste from another application such as Microsoft Word. In my case, this was being done in some administration screen, which stored a value that the user later wanted to display in a nicely formatted way; I chose to use the UltraFormattedTextEditor control which seemed the logical path to go down for displaying the required value.

I soon realised that I needed to limit how the formatted text was stored in SQL Server, so I opted to use the FormattedTextUIEditorForm, which is the form you see in design mode when looking at the UltraFormattedTextEditor control. Unfortunately this is not exposed with the out of the box Infragistics products (which is a great shame), you can however get to it if you have their source code. If you have this, you can find it in the SupportDialogs folder, and from there the FormattedTextEditor folder; the class you are interested in is FormattedTextUIEditorForm.cs

It was a bit of a pain to import Infragistics2.Win.SupportDialogs.csproj in to my solution and to get it to compile, but once this was working, I could call it directly like so (which is exactly what I needed to supply the user with to format their text how I needed it to be stored in the administration screen):

 

Try
Dim result As DialogResult
Dim value As String = String.Empty

Using formattedTextDialog As New FormattedTextUIEditorForm()

If (Me.DescriptionTextbox.Text.Trim().Length > 0) Then
formattedTextDialog.Value = Me.DescriptionTextbox.Text
End If

result = formattedTextDialog.ShowDialog()

value = CStr(formattedTextDialog.Value)

End Using

If (result = DialogResult.OK AndAlso value.Length > 0) Then
Me.DescriptionTextbox.Text = value
End If

Catch ex As Exception
‘handle exception
End Try

 

I needed to capture the value string (which is actually the raw text value) and store this in SQL Server, which would later get served up to the UltraFormattedTextEditor control. I did have an issue finding all of the required icons, I seemed to find them all except a few, including left align, right align etc. If you’ve used this in design view, you’ll know that you get the value tab which shows the text as you want it displayed, and also the raw text tab which is the formatted text, including the required html tags that you need to display in the UltraFormattedTextEditor control. I’ve included two screen shots showing my implementation; if it helps somebody else trying to overcome the same hurdle as me, then it was worth putting this article together:

Infragistics have since suggested that another solution would be to use the “Ribbon with Formatted Text Editor” from their installed samples. I’ve checked it out and it does actually do what I needed it to do, so this may be a simpler approach to achieving your goal, however I still like that fact that the FormattedTextUIEditorForm shows the raw text value on the fly.  See the screenshot below:

Read More →