Skip to content

C# equivalent of XAML compiled binding #1447

Answered by brminnick
tranb3r asked this question in Q&A
Discussion options

You must be logged in to vote

For Compiled Bindings in C#, you need to install the CommunityToolkit.Maui.Markup NuGet Package.

Docs

https://learn.microsoft.com/dotnet/communitytoolkit/maui/markup/extensions/bindable-object-extensions#one-way-binding

Example

using static CommunityToolkit.Maui.Markup.GridRowsColumns;

class SampleContentPage : ContentPage
{
    public SampleContentPage()
    {
        Content = new Grid
        {
            RowDefinitions = Rows.Define(
                (Row.TextEntry, 36)),

            ColumnDefinitions = Columns.Define(
                (Column.Description, Star),
                (Column.Input, Stars(2))),

            Children =
            {
                new Label()

Replies: 5 comments 16 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by brminnick
Comment options

You must be logged in to vote
2 replies
@brminnick
Comment options

@tranb3r
Comment options

Comment options

You must be logged in to vote
9 replies
@pictos
Comment options

@tranb3r
Comment options

@tranb3r
Comment options

@pictos
Comment options

@tranb3r
Comment options

Comment options

You must be logged in to vote
2 replies
@tranb3r
Comment options

@CliffAgius
Comment options

Comment options

You must be logged in to vote
3 replies
@bijington
Comment options

@brminnick
Comment options

@brminnick
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants