FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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.

    View source

    Members

    TYPE

    const TYPE: &'static $crate::TypeInfo
    

    The runtime type of this class.

    Source

    to_ref

    fn to_ref(self: &Self) -> $crate::Ref<VisualStateManager>
    

    Returns a strong reference to this object.

    Source

    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.

    Source

    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.

    Source

    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.

    Source

    construct

    fn construct() -> Self
    

    Source

    new

    fn new() -> Ref<Self>
    

    Source

    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).

    Source

    set_visual_state_groups

    fn set_visual_state_groups(element: &Control, value: Option<VisualStateGroupCollection>)
    

    Sets the groups of visual states of element.

    Source

    get_custom_visual_state_manager

    fn get_custom_visual_state_manager(element: &Control) -> Option<Ref<VisualStateManager>>
    

    The custom manager set on element, if any.

    Source

    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.

    Source

    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.

    Source

    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).

    Source

    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).

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.