Skin Selection for Applications and Controls

At design time, you can select system-defined and custom skins for PowerBuilder .NET applications and individual visual controls. You can also allow customers to change skins on applications and controls at runtime.

The ability to apply different skins to PowerBuilder .NET controls allows you to create visually compelling applications that can also be customized by application users. PowerBuilder provides system-defined skins, but also allows you to select custom skin files that use the XAML extension.

System-defined skins

The default skin defines the behavior and simulates the appearance of visual controls in PowerBuilder Classic. It also supports display themes that depend on system selections for the design time or runtime computers. These include the standard Microsoft Windows themes, such as Aero on Windows Vista, Luna on Windows XP, and Windows Classic on all Windows operating systems. Customized themes are also supported.

PowerBuilder also provides the following system-defined skins: ExpressionDark, Metal, RainierOrange, RoughGreen, and ShinyDarkTeal. These skins inherit from the default skin, enabling them to retain the behavior of all PowerBuilder controls. However, their styles are not affected by the theme setting of the host computer, and they display control surfaces with different colors.

The Application object in all WPF Windows applications always has a skin, whether the application has been migrated from a PowerBuilder Classic target or created from scratch. By default, visual controls are not assigned a skin. However, if you do not assign skins to visual controls, they inherit skin settings from their immediate parent. For example, if there is no skin defined for a CommandButton, it takes its parent control's skin. The parent can be a GroupBox, TabPage, Window, or other container control. If the container controls do not have assigned skins, the CommandButton uses the skin set in the Application object.

Note: Skin inheritance works only at runtime. If the Skin property is not set on a control, the skin of its container or the Application object is not applied at design time.

Custom skins

You can create and select custom skins to affect the styles (colors, fonts, borders, and so on) of the visual controls in PowerBuilder .NET applications. However, if you use a custom skin that is not based on the system-defined default skin, you are likely to lose some of the controls' more complex behaviors that are embedded in the default skin's XAML definitions.

Add custom skin files to the directory containing the application executable, or to a subdirectory of that directory. You can select the custom skin for a control by assigning it to the Skin property for the control.

To use the custom skin at runtime, add the XAML file to a folder that you create under the target containing the control. If the compile-time Build Action property in the Properties view for the XAML file is set to "Content" (the default), the XAML file is deployed as a standalone file. If you set the Build Action property to "Embedded Resource," the XAML file is compiled into the target assembly. Custom skins are not applied at runtime if the Build Action property for the XAML file is set to "None" when the project is deployed.

Skin property

The Skin property is available for all visual controls and for the Application object in a WPF Window target. You can set the value of the Skin property in PowerScript code, or by entering it in the Properties view for a visual control or the Application object. The Skin property is under the General category in the Properties view when you display properties by category.

The datatype of the Skin property is string. You can set this property to a system-defined skin, or to a custom skin file with a XAML extension. The default skin is designated by an empty string (" ").

This example sets an application-level skin to the system-defined Metal skin:
applicationName.Skin = “Metal”			
This example sets a window-level skin to an external file:
w_main.Skin = “skin1.xaml”