I have a explorer bar (dock left) and a panel (rest of form). I want a title on the panel which reflects the selected explorer bar group. I added a ultralabel docked to the top of the panel. What is the best way to style the label to look just like the explorer bar group?
Any reference to a tutorial? It is very, very frustrating trying to use your controls with the documentation that you provide. Is there any third party documentation available. Please don't ask, "What is missing?" EVERYTHING.
Hi,
Are you using Application Styling in your application? You are posting in the AppStylist forum, but since you are asking about styling an individual label control, I just want to make sure I understand what you are doing.
Or are you trying to do this in code?
If you are using AppStyling, then the style library will style all of the label controls in your application the same. In which case, styling a single individual label would be more complicated.
If you just want to do this in code, then what you would have to do is get the resolved appearance of the Explorer Group header at run-time and copy those properties to the appearance properties of the label. This will work in general, but it's really not a great approach because the header appearance itself may be relying on some other UIElement that is behind the header.
try something like this:
AppearanceData appearanceData = new AppearanceData(); AppearancePropFlags appearancePropFlags = AppearancePropFlags.AllRender; this.ultraExplorerBar1.Groups[0].ResolveHeaderAppearance(ref appearanceData, ref appearancePropFlags); this.ultraLabel1.Appearance.BackColor = appearanceData.BackColor; this.ultraLabel1.Appearance.BackColor2 = appearanceData.BackColor2; this.ultraLabel1.Appearance.BackGradientStyle = appearanceData.BackGradientStyle; this.ultraLabel1.Appearance.ForeColor = appearanceData.ForeColor; //etc.
Yes, I am using app styling. I was expecting to set the appearance of the label based on the style of the explorer bar header in code.
This label should be styled differenent than other labels. So, should I turn off app styling for the label? Is there a way to extract the style from the header, and apply the whole appearance to the label, without applying the individual properties?
I am using the Outlook Navigation Pane Style, which Appearance represents the Current Group Header?
Also, there are a plethoria of Appearances hanging off of the AppearancesSmall and AppearancesLarge properties on the GroupSettings of the Explorer Bar. How do I resolve all of these appearances? I don't see a resolve method.
There's no single Appearance property you can use. The Appearance of the header (and most other objects in NetAdvantage) is resolved based on all of the applicable appearances, plus application styling. So to resolve the appearance of the header, you have to use one of the ResolveAppearance methods. I don't understand what you mean when you say you don't see a resolve method. I gave you the code for this above. Are you saying the method does not exist in your version of UltraExplorerBar? I don't see how that could be. It's always been there as far as I know.
If you want one particular label to appear different than other labels and you want it to pick up the appearance of an ExplorerBar header, then you can't do this through AppStylist. AppStylist doesn't know anything about one individual label it styles the whole application. So what you would have to do here is turn off AppStyling for this label by setting the UseAppStyling property of the label control to false in code. Then you can apply whatever appearance to the label that you want.
An alternative to this would be to add a new StyleSet to your Application Style Library just for the label. You could then make the labels in this StyleSet look like the ExplorerBar headers in the default StyleSet. Then all you do is set the StyleSetName property on the label(s) to the name of your StyleSet.
I used the simplest overload of the ResolveHeaderAppearance method. But there's are a number of overloads. The most complex one take a param called isNavigationPaneHeader, for which you will, of course, want to pass in true.
The code you provided returns the appearance of the group header, not the current group header for the Outlook Navigation Pane style of explorer bar. By Current Group Header I mean the bar at the top of the explorer control. The Group Header appearance seems to represent the group bars in the lower portion of the explorer bar.