dotnet / dotnet/docs-maui

Add examples for binding to x:Static, StaticResource or directly to an object

Open
#570 0 comments 0 reactions 0 assignees View on GitHub
doc-enhancement dotnet-maui/tech dotnet-mobile/prod Pri2
Dominant language
No language data
Stars
282
Forks
265
Avg merge
2d 2h
Merged PRs (30d)
19

Description

At the paragraph near the bottom

The examples shown so far set the BindingContext property and the Source property of Binding to an **x:Reference markup extension** to reference another view on the page. These two properties are of type Object, and they can be set to any object that includes properties that are suitable for binding sources.

You can also set the BindingContext or Source property to:

- an **x:Static markup extension** to reference the value of a static property or field,

- or a **StaticResource markup extension** to reference an object stored in a resource dictionary,

- or **directly to an object**, which is often an instance of a **viewmodel**.

For a noob like me, I haven't a clue what this means, so could you please show the three examples as code so that I can study it. I'm pretty sure this is important, **especially the last one!!!**

Also format the paragraph to help readability.

The examples on the text and slider previously were actually good once I'd got my head around them and studied them carefully. :)

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 1ce42af9-5ff2-9b3f-4618-65ba90a67813
* Version Independent ID: 1ce42af9-5ff2-9b3f-4618-65ba90a67813
* Content: [Basic bindings - .NET MAUI](https://docs.microsoft.com/en-us/dotnet/maui/fundamentals/data-binding/basic-bindings)
* Content Source: [docs/fundamentals/data-binding/basic-bindings.md](https://github.com/dotnet/docs-maui/blob/main/docs/fundamentals/data-binding/basic-bindings.md)
* Product: **dotnet-mobile**
* Technology: **dotnet-maui**
* GitHub Login: @davidbritch
* Microsoft Alias: **dabritch**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.