+
+To add a visual to a control, first create a Property for the visual of type MAP, and ensure the name has a suffix of "_VISUAL". Then the visual is normally defined in the stylesheet, and the definition sent via SetProperty(), where you would then create the visual:
+
+~~~{.cpp}
+// C++
+void Internal::MyUIControl::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
+{
+ MyUIControl control = MyUIControl::DownCast( Dali::BaseHandle( object ) );
+ switch( index )
+ {
+ case MyUIControl::Property::MY_VISUAL:
+ {
+ Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get();
+ const Property::Map *map = value.GetMap();
+ if( map && !map->Empty() )
+ {
+ Toolkit::Visual::Base visual = visualFactory.CreateVisual( *map );
+ GetImplementation( control ).RegisterVisual( index, visual );
+ }
+ break;
+ }
+ //...
+ }
+}
+~~~
+
+The [Visuals](@ref visuals) section describes the property maps that can be used for each visual type.
+