# ServiceProviderExtensions

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-markup-xaml/trait-serviceproviderextensions/

**trait** · [`ferroui-markup-xaml`](/docs/0.5.0/api/ferroui-markup-xaml/) · v0.5.0

```rust
trait ServiceProviderExtensions
```

The lookups built on the services of a markup service provider.

(`GetService<T>` of the managed original is
`get_service_of` of the
service provider contract itself.)

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/extensions.rs#L20)

## Members

- [`get_required_service`](#function-get_required_service)
- [`get_context_base_uri`](#function-get_context_base_uri)
- [`get_name_scope`](#function-get_name_scope)
- [`get_first_parent`](#function-get_first_parent)
- [`get_last_parent`](#function-get_last_parent)
- [`get_parents`](#function-get_parents)
- [`is_in_control_template`](#function-is_in_control_template)
- [`resolve_type`](#function-resolve_type)
- [`get_default_anchor`](#function-get_default_anchor)

<a id="function-get_required_service"></a>

### get_required_service

```rust
fn get_required_service<T: Clone + 'static>(self: &Self) -> T
```

The service used through the handle type `T`. Panics if the provider
has no such service: a markup runtime without it is misconfigured.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/extensions.rs#L23)

<a id="function-get_context_base_uri"></a>

### get_context_base_uri

```rust
fn get_context_base_uri(self: &Self) -> Option<url::Url>
```

The base URI of the document being loaded.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/extensions.rs#L26)

<a id="function-get_name_scope"></a>

### get_name_scope

```rust
fn get_name_scope(self: &Self) -> Option<Rc<dyn INameScope>>
```

The name scope in effect. A provider may publish it as a contract
handle or as the property-value handle; both are asked for.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/extensions.rs#L30)

<a id="function-get_first_parent"></a>

### get_first_parent

```rust
fn get_first_parent<T: FromXamlObject>(self: &Self) -> Option<T>
```

The nearest parent that is a `T`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/extensions.rs#L33)

<a id="function-get_last_parent"></a>

### get_last_parent

```rust
fn get_last_parent<T: FromXamlObject>(self: &Self) -> Option<T>
```

The outermost parent that is a `T`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/extensions.rs#L36)

<a id="function-get_parents"></a>

### get_parents

```rust
fn get_parents<T: FromXamlObject>(self: &Self) -> Vec<T>
```

The parents that are a `T`, the nearest first.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/extensions.rs#L39)

<a id="function-is_in_control_template"></a>

### is_in_control_template

```rust
fn is_in_control_template(self: &Self) -> bool
```

Whether the content of a control template is being built.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/extensions.rs#L42)

<a id="function-resolve_type"></a>

### resolve_type

```rust
fn resolve_type(self: &Self, namespace_prefix: Option<&str>, type_: &str) -> Result<CastTarget, XamlLoadError>
```

Resolves a type name with the namespaces of the document.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/extensions.rs#L45)

<a id="function-get_default_anchor"></a>

### get_default_anchor

```rust
fn get_default_anchor(self: &Self) -> Option<Ref<FerroObject>>
```

An object from which bindings whose target is not a control can
locate a data context, named controls and style resources.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/extensions.rs#L49)

## Trait implementations

- [`ServiceProviderExtensions`](/docs/0.5.0/api/ferroui-markup-xaml/trait-serviceproviderextensions/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
