VisualStateManager
struct · ferroui-controls · v0.5.0
struct VisualStateManager
Manages the visual states of controls and the transitions between them.
The visual states of an element are the visual_state_groups_property
attached to the root of its visual states: for a templated control the root of its template,
for a user control (or any content control, or content page) whose template has none, the
control that is its content. go_to_state makes a state the current state of its group.
A custom manager derives from this class, overrides
go_to_state_core and is set on the root with
set_custom_visual_state_manager.
Members
TYPEto_refgo_to_state_corevisual_state_groups_propertycustom_visual_state_manager_propertyconstructnewget_visual_state_groupsset_visual_state_groupsget_custom_visual_state_managerset_custom_visual_state_managergo_to_stateraise_current_state_changingraise_current_state_changed
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<VisualStateManager>
Returns a strong reference to this object.
go_to_state_core
fn go_to_state_core(self: &Self, control: &Ref<Control>, template_root: &Ref<Control>, state_name: &str, group: Option<&Ref<VisualStateGroup>>, state: Option<&Ref<VisualState>>, use_transitions: bool) -> bool
Changes the state of group to state (WinUI's overridable GoToStateCore).
template_root is the element that has the groups; group and state are the
group and the state named state_name, or None when no group has a state of that
name (a custom manager is called either way). The base method changes the state when
both are given and returns whether it did.
visual_state_groups_property
fn visual_state_groups_property() -> &'static AttachedProperty<Option<VisualStateGroupCollection>>
Defines the attached VisualStateGroups property: the groups of visual states of an
element. get_visual_state_groups
creates the collection when the element has none, which is what markup's property
element syntax (<VisualStateManager.VisualStateGroups>) adds the groups to.
custom_visual_state_manager_property
fn custom_visual_state_manager_property() -> &'static AttachedProperty<Option<Ref<VisualStateManager>>>
Defines the attached CustomVisualStateManager property: the manager that changes the
states of the groups of the element it is set on.
construct
fn construct() -> Self
new
fn new() -> Ref<Self>
get_visual_state_groups
fn get_visual_state_groups(element: &Control) -> VisualStateGroupCollection
The groups of visual states of element; an empty collection is created and set when the
element has none (WinUI's GetVisualStateGroups).
set_visual_state_groups
fn set_visual_state_groups(element: &Control, value: Option<VisualStateGroupCollection>)
Sets the groups of visual states of element.
get_custom_visual_state_manager
fn get_custom_visual_state_manager(element: &Control) -> Option<Ref<VisualStateManager>>
The custom manager set on element, if any.
set_custom_visual_state_manager
fn set_custom_visual_state_manager(element: &Control, value: Option<Ref<VisualStateManager>>)
Sets the custom manager of the groups of element.
go_to_state
fn go_to_state(control: &Control, state_name: &str, use_transitions: bool) -> bool
Makes the state named state_name the current state of its group (WinUI's GoToState).
The groups are those of the root of the visual states of control (see the type). Returns
false, and changes nothing, when there is no such root or no group has a state of that
name (names are case-sensitive); a custom manager on the root decides instead. Entering
the current state again with use_transitions == false applies its values again; with
transitions it does nothing. Either way it returns true.
raise_current_state_changing
fn raise_current_state_changing(self: &Self, group: &Ref<VisualStateGroup>, old_state: Option<Ref<VisualState>>, new_state: Option<Ref<VisualState>>, control: Option<Ref<Control>>)
Raises CurrentStateChanging of group (for derived managers; WinUI's protected
RaiseCurrentStateChanging).
raise_current_state_changed
fn raise_current_state_changed(self: &Self, group: &Ref<VisualStateGroup>, old_state: Option<Ref<VisualState>>, new_state: Option<Ref<VisualState>>, control: Option<Ref<Control>>)
Raises CurrentStateChanged of group (for derived managers; WinUI's protected
RaiseCurrentStateChanged).
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeVisualStateManagerImplExtBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyFerroObjectImplExtClassDefaultsErasedDestructorIntoEitherDerefUpcast<T>Upcast<VisualStateManager>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleFerroObjectImplVisualStateManagerImpl
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.