FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    Control

    struct · ferroui-controls · v0.5.0

    struct Control
    

    Base class for controls.

    The control class extends InputElement and adds the following features:

    • A Tag property to allow user-defined data to be attached to the control.

    View source

    Members

    find_data_template

    fn find_data_template(self: &Self, data: Option<&BoxedValue>, primary: Option<&Rc<dyn IDataTemplate>>) -> Option<Rc<dyn IDataTemplate>>
    

    Find a data template that matches a piece of data.

    primary is an optional primary template that can display the data. Returns the data template or None if no matching data template was found.

    Source

    TYPE

    const TYPE: &'static $crate::TypeInfo
    

    The runtime type of this class.

    Source

    to_ref

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

    Returns a strong reference to this object.

    Source

    get_template_focus_target

    fn get_template_focus_target(self: &Self) -> Option<Ref<Control>>
    

    Gets the element that receives the focus adorner.

    Source

    on_loaded

    fn on_loaded(self: &Self, e: &RoutedEventArgs)
    

    Raises the Loaded event.

    Source

    on_unloaded

    fn on_unloaded(self: &Self, e: &RoutedEventArgs)
    

    Raises the Unloaded event.

    Source

    on_size_changed

    fn on_size_changed(self: &Self, e: &SizeChangedEventArgs)
    

    Raises the SizeChanged event.

    Source

    on_create_automation_peer

    fn on_create_automation_peer(self: &Self) -> Ref<AutomationPeer>
    

    Returns a new, type-specific automation peer implementation for the control.

    Source

    effective_context_flyout

    fn effective_context_flyout(self: &Self, for_request: bool) -> Option<Ref<FlyoutBase>>
    

    The flyout a context request on the control shows (for_request), or that its keys and cancellation dismiss: ContextFlyout by default. A control whose context flyout belongs to another element (a linked text container) resolves it here, and may show none for a request. An addition (docs/porting/DEVIATIONS.md, Popup).

    Source

    context_request_generation

    fn context_request_generation(self: &Self) -> Option<u64>
    

    A counter the control advances when it raises a newer context request of its own while an older one is being handled; None by default. The context menu and flyout drop the older request when it changed. An addition (docs/porting/DEVIATIONS.md, Popup).

    Source

    focus_adorner_property

    fn focus_adorner_property() -> &'static StyledProperty<Option<Rc<dyn ITemplateOf<Option<Ref<Control>>>>>>
    

    Defines the FocusAdorner property.

    Source

    tag_property

    fn tag_property() -> &'static StyledProperty<Option<BoxedValue>>
    

    Defines the Tag property.

    Source

    context_menu_property

    fn context_menu_property() -> &'static StyledProperty<Option<Ref<ContextMenu>>>
    

    Defines the ContextMenu property.

    Source

    context_flyout_property

    fn context_flyout_property() -> &'static StyledProperty<Option<Ref<FlyoutBase>>>
    

    Defines the ContextFlyout property.

    Source

    request_bring_into_view_event

    fn request_bring_into_view_event() -> &'static RoutedEvent<RequestBringIntoViewEventArgs>
    

    Event raised when an element wishes to be scrolled into view.

    Source

    loaded_event

    fn loaded_event() -> &'static RoutedEvent<RoutedEventArgs>
    

    Defines the Loaded event.

    Source

    unloaded_event

    fn unloaded_event() -> &'static RoutedEvent<RoutedEventArgs>
    

    Defines the Unloaded event.

    Source

    size_changed_event

    fn size_changed_event() -> &'static RoutedEvent<SizeChangedEventArgs>
    

    Defines the SizeChanged event.

    Source

    construct

    fn construct() -> Self
    

    Creates the class data; see ferroui_base::FerroObject::construct.

    Source

    new

    fn new() -> Ref<Self>
    

    Source

    focus_adorner

    fn focus_adorner(self: &Self) -> Option<Rc<dyn ITemplateOf<Option<Ref<Control>>>>>
    

    The control's focus adorner.

    Source

    set_focus_adorner

    fn set_focus_adorner(self: &Self, value: Option<Rc<dyn ITemplateOf<Option<Ref<Control>>>>>)
    

    Source

    data_templates

    fn data_templates(self: &Self) -> DataTemplates
    

    The data templates for the control.

    Each control may define data templates which are applied to the control itself and its children.

    Source

    is_data_templates_initialized

    fn is_data_templates_initialized(self: &Self) -> bool
    

    Whether the data templates collection has been created.

    Source

    context_menu

    fn context_menu(self: &Self) -> Option<Ref<ContextMenu>>
    

    A context menu to the control.

    Source

    set_context_menu

    fn set_context_menu(self: &Self, value: impl Into<Nullable<ContextMenu>>)
    

    Source

    context_flyout

    fn context_flyout(self: &Self) -> Option<Ref<FlyoutBase>>
    

    A context flyout to the control.

    Source

    set_context_flyout

    fn set_context_flyout(self: &Self, value: impl Into<Nullable<FlyoutBase>>)
    

    Source

    is_loaded

    fn is_loaded(self: &Self) -> bool
    

    Whether the control is fully constructed in the visual tree and both layout and render are complete.

    This is set to true while raising the Loaded event.

    Source

    tag

    fn tag(self: &Self) -> Option<BoxedValue>
    

    A user-defined object attached to the control.

    Source

    set_tag

    fn set_tag(self: &Self, value: Option<BoxedValue>)
    

    Source

    loaded

    fn loaded(self: &Self, handler: impl Fn(&Interactive, &RoutedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
    

    Occurs when the control has been fully constructed in the visual tree and both layout and render are complete.

    This event is guaranteed to occur after the control template is applied and references to objects created after the template is applied are available. This makes it different from on_attached_to_visual_tree which doesn't have these references. This event occurs at the latest possible time in the control creation life-cycle.

    Source

    unloaded

    fn unloaded(self: &Self, handler: impl Fn(&Interactive, &RoutedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
    

    Occurs when the control is removed from the visual tree.

    This is API symmetrical with loaded and exists for compatibility with other XAML frameworks; however, it behaves the same as on_detached_from_visual_tree.

    Source

    size_changed

    fn size_changed(self: &Self, handler: impl Fn(&Interactive, &SizeChangedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
    

    Occurs when the bounds (actual size) of the control have changed.

    Source

    boxed

    fn boxed(control: impl IntoRef<Control>) -> BoxedValue
    

    The boxing convention for a control held in an untyped value (a Content, a Tag, an item): the value holds a Ref<Control>.

    Source

    from_boxed

    fn from_boxed(value: &BoxedValue) -> Option<Ref<Control>>
    

    The control held by an untyped value, if it holds one (value as Control upstream). See boxed.

    The value is a control whatever handle it holds it by: the Ref<Control> of the boxing convention, the handle of another class of the object model (a Ref<Border>, a Ref<FerroObject>), or an interface handle that holds an object (ValueTypes::register_interface_object); a value that a binding passes on keeps the static type of its source.

    Source

    logical_from_boxed

    fn logical_from_boxed(value: &BoxedValue) -> Option<Ref<StyledElement>>
    

    The logical element held by an untyped value, if it holds one (value as ILogical upstream): an element held by any handle, as from_boxed takes it.

    Source

    ensure_initialized

    fn ensure_initialized(self: &Self)
    

    Ensures that the control is initialized and laid out when it is used as the source of a visual brush while not attached to a visual root.

    Source

    bring_into_view

    fn bring_into_view(self: &Self)
    

    Tries to bring the control into view.

    Source

    bring_into_view_rect

    fn bring_into_view_rect(self: &Self, rect: Rect)
    

    Tries to bring the control into view.

    rect is the area of the control to being into view.

    Source

    find_control

    fn find_control<T: ObjectType>(self: &Self, name: &str) -> Option<Ref<T>>
    

    Finds the named control in the scope of the specified control.

    Returns the control or None if not found; panics if the control has no parent name scope or the named control is of a different class.

    Source

    get_control

    fn get_control<T: ObjectType>(self: &Self, name: &str) -> Ref<T>
    

    Gets the named control in the scope of the specified control.

    Panics if the control has no parent name scope or the named control is not found.

    Source

    set_pseudo_class_from

    fn set_pseudo_class_from(self: &Self, name: &str, trigger: &dyn IObservable<bool>) -> Subscription
    

    Sets a pseudoclass of the control depending on an observable trigger.

    Dropping the returned guard stops following the trigger; Subscription::detach keeps it for the life of the trigger.

    Source

    Trait implementations

    Availability

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