Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binding Border.StrokeShape RoundRectangle CornerRadius not working #22637

Open
AlleSchonWeg opened this issue May 24, 2024 · 2 comments
Open
Labels
area-controls-border Border area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing platform/android 🤖 t/bug Something isn't working
Milestone

Comments

@AlleSchonWeg
Copy link

Description

Hi,
if you bind then CornerRadius to a ViewModel property the value is not recognized:

      <Border x:Name="myBorder"
              Margin="0,10,0,0"
              BackgroundColor="Blue"
              Padding="0"
              StrokeThickness="0">
        <Border.StrokeShape>
          <RoundRectangle CornerRadius="{Binding Corner}" />
        </Border.StrokeShape>
        <Label Text="Welcome to &#10;.NET Multi-platform App UI"
               Style="{StaticResource SubHeadline}"
               SemanticProperties.HeadingLevel="Level2"
               SemanticProperties.Description="Welcome to dot net Multi platform App U I" />
      </Border>

Viewmodel:

        public TestViewModel()
        {
            Corner = new CornerRadius(4);
        }

The corner should be 4. But it's set to 0:
image

Also if you click the button and set it to 12:

        private void OnCounterClicked(object sender, EventArgs e)
        {
            var model = (TestViewModel)BindingContext;
            model.Corner = new CornerRadius(12);
        }

Steps to Reproduce

Open Repro.
Nightly Version: 8.0.60-ci.net8.24274.1
MauiApp8.zip

Link to public reproduction project repository

No response

Version with bug

Nightly / CI build (Please specify exact version)

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

@AlleSchonWeg AlleSchonWeg added the t/bug Something isn't working label May 24, 2024
Copy link
Contributor

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@rmarinho rmarinho added this to the Backlog milestone May 24, 2024
@rmarinho rmarinho added area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing area-controls-border Border labels May 24, 2024
@kubaflo
Copy link
Collaborator

kubaflo commented Jun 8, 2024

Hi, @AlleSchonWeg a quick fix to your issue would be to use data binding with x:reference

<Border.StrokeShape>
   <RoundRectangle CornerRadius="{Binding BindingContext.Corner, Source={x:Reference Self}}" />
</Border.StrokeShape>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-border Border area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing platform/android 🤖 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants