I'm experiencing a new appearance for our mainstream application and I'm using hard current AppStylist for Windows Forms v12.1 (12.1.20121.1001).
I attacked this rocky mountain loading one of the preset styles, basically the Office2010Silver style.
Loading the style at runtime isn't a problem: it runs finely from embedded resource and from external file too.
In order to complete my style file and having it ready for the application release, I'm facing some minor issues I would like to fix as soon as possible. I list them below:
DASHED MENU ITEM SEPARATORS
Menu item separators are dashed and it's a bit disappointing for our staff. I noticed that there's no matching bitmap to for that fashed separator and I have no idea where searching for.
NAVIGATOR DIALOG HIGHLIGHTED ITEM
I managed also the UI Role NavigatorDialog, but no luck to change the background color of the highlighted window item. It seems having the same background color of the navigator dialog background. However if you move the mouse over the window items in the dialog, the item hovered by the mouse is coloured with an appropriate background.
FLOATING TOOLBAR BORDER COLOR
I can't find also the floating toolbar border color in the UI Roles. Where is it?
I worked out how to override the dashed menu item separator with a Custom Draw Filter. I'm going to use the same workaround even with the other issues:
Public Function GetPhasesToFilter(ByRef drawParams As Infragistics.Win.UIElementDrawParams) As Infragistics.Win.DrawPhase _ Implements Infragistics.Win.IUIElementDrawFilter.GetPhasesToFilter If (TypeOf (drawParams.Element) Is PopupMenuSeparatorItemUIElement) Then Return DrawPhase.AfterDrawElement End If Return Infragistics.Win.DrawPhase.None End Function Public Function DrawElement(ByVal drawPhase As Infragistics.Win.DrawPhase, _ ByRef drawParams As Infragistics.Win.UIElementDrawParams) As Boolean _ Implements Infragistics.Win.IUIElementDrawFilter.DrawElement If (drawParams.Element Is Nothing) Then Return False If (TypeOf (drawParams.Element) Is PopupMenuSeparatorItemUIElement) Then Return DrawPopupMenuItemSeparator(drawPhase, drawParams) End If Return False End Function
Hello ,
The style (i.e. solid vs dashed) of the MenuItemSeparator is based off of the UltraToolbarsManager’s resolved Style (ToolbarStyle). So you could use DrawFilter in order to change the style of MenuItemSeparator. The other separator, which you mentioned is actually is GrabHangler and you could modify it setting this.ultraToolbarsManager1.ToolbarSettings.GrabHandleStyle
To change the color of the FloatingToolbarBorder is to use a DrawFilter to resolve the BackColor of the FloatingToolbarCaption UIRole, and assign it to the drawParams.AppearanceData.
#region IUIElementDrawFilter Members
public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams)
{
if (drawParams.Element is FloatingToolbarUIElement)
AppearancePropFlags flags = AppearancePropFlags.BackColor;
AppearanceData data = new AppearanceData();
UIRole role = this.ultraToolbarsManager1.ComponentRole.GetRole(134);
role.ResolveAppearance(ref data, ref flags, RoleState.Normal);
if (data.HasPropertyBeenSet(AppearancePropFlags.BackColor))
drawParams.AppearanceData.BackColor = data.BackColor;
}
return false;
public DrawPhase GetPhasesToFilter(ref UIElementDrawParams drawParams)
return DrawPhase.BeforeDrawBackColor;
return DrawPhase.None;
#endregion
I have implemented this suggestions in a small sample, please run the sample and let me know if this is what you are looking for.
Please let me know if you have any further questions.
Thank you for your answer.
And what about the issue of the backcolor of PopupToolUIElement shown in the NavigatorDialog? At now some styles available in your examples have wrong background colors when highlighted in the Navigator Dialog with CTRL-TAB shortcut.I mean the styles in this folder:C:\Users\Public\Documents\Infragistics\NetAdvantage 2012.1\Windows Forms\AppStylist for Windows Forms\Styles\
Hello,
You could change back color of selected item of NavigatorDialor, if you adjust ultraDockManager1.NavigatorSettings.SelectedItemAppearance object. Please see attached sample.
Please let me know if you have any further questions
Thank you for your feedback. Could you please let me know if we could consider your issue as resolved or you still need help on this ?
Thank you for using Infragistics Components.
First version of the code snippet drew the line just at the top of the previous item, not below it. Second version fixed this issue. At now I made it more robust, asserting the previous item still exists, otherwise I don't draw anything.
Thank you again for your support.
How exactly you are calculating the location of the line ? I have review your code sniped of previous post and I have noticed that you were calling DrawPopupMenuItemSeparator(drawPhase, drawParams) which draws your menu separator, but it doesn’t show how exactly the location is calculating. If you look into the sample which I have posted you will noticed that I am using location of the parent element, in order to calculate position of the item separator and in my sample the separator doesn’t disappear if you hover onto item above
Here is the code snippet for calculating of position of item separator
UIElement par = drawParams.Element.Parent;
UIElement prev = par.ChildElements[par.ChildElements.IndexOf(drawParams.Element) - 1].GetDescendant(typeof(TextUIElement));
Point EndPoint = prev.Rect.Location;
EndPoint.Offset(prev.Rect.Width - 1, prev.Rect.Height);
Point StartPoint = prev.Rect.Location;
StartPoint.Offset(1, prev.Rect.Height);
drawParams.Graphics.DrawLine(separatorPan, StartPoint, EndPoint);
ret = true;
I noticed that the tip suggested for the continuous line as menu item separator disappears when you are hovering the menu item above, if it has its own icon. Maybe the continuous line should be drawn a pixel lower.
Thank you for your feedback and shared experience, I think that this topic could be at help and for other customers facing this issue.
Please let me know if you have any further questions regarding this matter.