Ian Vink
Ian Vink

Reputation: 68800

Xamarin XAML: Setting Attached Property in Code

I have a custom control with AbsoluteLayout attached properties:

        <common:FabImage
            AbsoluteLayout.LayoutFlags="PositionProportional"
            AbsoluteLayout.LayoutBounds="1.0,1.0,-1,-1">
        </common:FabImage>

How can I set these properties in C# in the code so I can default them?

Upvotes: 1

Views: 291

Answers (1)

Nick Peppers
Nick Peppers

Reputation: 3251

I'm assuming you want to set this in your FabImage cs code, which can be done like so:

AbsoluteLayout.SetLayoutBounds(this, new Rectangle(1.0, 1.0, -1, -1));
AbsoluteLayout.SetLayoutFlags(this, AbsoluteLayoutFlags.PositionProportional);

Upvotes: 3

Related Questions