Hi,
I have an UltraTree which has a view style of OutlookExpress with multiple columns.
I'm having problem displaying image on the left hand side of the node (first column). Sample code is attached with configuration of UltraTree.
Also, on "Index" column, how do I remove space on the left of the text so I can have it exactly the same with column "Value".
Thanks.
The reason there is space there is that you are using the OutlookExpress ViewStyle, under which the expansion indicator appears within cells of the the leftmost column whose data type is string. The space is there regardless of whether there is an expansion indicator because otherwise they would not all be aligned properly.
You can set the CanShowExpansionIndicator property to false for all columns if you want to prevent them from appearing altogether.
Hi Brian,
Thanks for the reply. I solved the problem with image not displaying on the nodes. But I still can't figure out why the text of the two columns is displayed differently using the same configuration. Later I found that when I comment out the datatype of "Index" column, the text is finally displayed correctly but this doesn't happen to "Value" column. Any idea?
Private Sub Initialize()
Dim rootColumnSet As UltraTreeColumnSet = uTree.ColumnSettings.RootColumnSet rootColumnSet.Columns.Clear()
With uTree .DisplayStyle = UltraTreeDisplayStyle.Standard .ViewStyle = ViewStyle.OutlookExpress .FullRowSelect = True .HideSelection = False .ExpansionIndicatorSize = New Size(0, 0) .ScrollBounds = ScrollBounds.ScrollToLastItem .SelectionBehavior = UltraWinTree.SelectionBehavior.ExtendedAcrossCollections
With .ColumnSettings .BorderStyleCell = UIElementBorderStyle.Solid .AutoFitColumns = AutoFitColumns.ResizeAllColumns .CellAppearance.BorderColor = SystemColors.Control .HeaderStyle = HeaderStyle.WindowsVista
With .ColumnHeaderAppearance .BorderColor = Color.Silver End With End With
End With
_IndexColumn = rootColumnSet.Columns.Add("Index") With _IndexColumn .Text = "Index" '.DataType = GetType(String) .LayoutInfo.PreferredCellSize = New Size(CInt(Me.Width / 2), 22) .AllowSorting = DefaultableBoolean.True .ShowSortIndicators = DefaultableBoolean.True .TipStyleCell = TipStyleCell.Show End With
_ValueColumn = rootColumnSet.Columns.Add("Value") With _ValueColumn .Text = "Value" .DataType = GetType(String) .LayoutInfo.PreferredCellSize = New Size(CInt(Me.Width / 2), 22) .AllowSorting = DefaultableBoolean.True .ShowSortIndicators = DefaultableBoolean.True .TipStyleCell = TipStyleCell.Show End With
End Sub
There is no code attached to this article. The same image can be displayed within all cells associated with a particular column by setting the UltraTreeNodeColumn.CellAppearance.Image property; a different image can be displayed by accessing the UltraTreeNodeCell (an object of this type is returned for each column via the UltraTreeNode.Cells collection), and setting its Appearance.Image property.
I have no explanation for why the text appears differently for the Index column; one possibility would be that you are using different editors for each column. If you attach a small sample we can take a look and figure out why.