-
-
Notifications
You must be signed in to change notification settings - Fork 341
Styling
Styling allows you to have platform-specific code applied to controls. The framework allows you to easily separate the non-platform specific Eto.Forms code from the platform-specific code, usually in different assemblies.
This also allows you to add custom platform-specific controls to your UI, but it is recommended to create Eto.Forms Custom Controls instead.
The style is applied using the Style property for each control. In the platform-specific assembly/launcher, you then add styles using the static Style.Add() methods.
This example shows how to change the highlight style of a listview for MonoMac/Cocoa apps. Each time a list box is created with the style of "main-list", it will execute the platform-specific code.
In your Eto.Forms UI code:
var mylist = new ListBox{ Style = "main-list" };
In your OS X app (usually called before the application starts):
Style.Add<ListBox, NSScrollView>("main-list", (widget, control) => {
var table = control.DocumentView as NSTableView;
table.SelectionHighlightStyle = NSTableViewSelectionHighlightStyle.SourceList;
});