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

Border does not change rendering when modifying StrokeShape properties #13988

Closed
etvorun opened this issue Mar 16, 2023 · 1 comment · Fixed by #13793
Closed

Border does not change rendering when modifying StrokeShape properties #13988

etvorun opened this issue Mar 16, 2023 · 1 comment · Fixed by #13793
Assignees
Labels
area-controls-border Border area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149! platform/windows 🪟 t/bug Something isn't working

Comments

@etvorun
Copy link
Contributor

etvorun commented Mar 16, 2023

Description

XAML Hot Reload does not work when editing properties of Border.StrokeShape object, e.g. changing corner radius.

Steps to Reproduce

  1. New MAUI app.
  2. Open MainPage.xaml and replace content of ContentPage element with
  <VerticalStackLayout>
    <Border x:Name="MyBorder" WidthRequest="400" HeightRequest="200"  HorizontalOptions="Start"
        Background="Yellow" Stroke="Red" StrokeThickness="2" Margin="4">
                <Border.StrokeShape>
                    <RoundRectangle CornerRadius="10" />
                </Border.StrokeShape>
      <Label x:Name="Txt" HeightRequest="30" HorizontalOptions="Start" Margin="10,2"/>
    </Border>
    <Button Text="Increase CornerRadius" Clicked="OnIncreaseCornerRadius" Margin="4" HorizontalOptions="Start" />
    <Button Text="Decrease CornerRadius" Clicked="OnDecreaseCornerRadius" Margin="4" HorizontalOptions="Start" />
  </VerticalStackLayout>
  1. Open MainPage.xaml.cs and replace implementation with
public partial class MainPage : ContentPage
{
    public MainPage() => InitializeComponent();
    private void OnIncreaseCornerRadius(object sender, EventArgs e) => ChangeCornerRadius(10);
    private void OnDecreaseCornerRadius(object sender, EventArgs e) => ChangeCornerRadius(-10);
    private void ChangeCornerRadius(double delta)
    {
        RoundRectangle rr = (RoundRectangle)this.MyBorder.StrokeShape;
        double radius = Math.Max(0, rr.CornerRadius.TopLeft + delta);
        rr.CornerRadius = new CornerRadius(radius);
        this.Txt.Text = $"Border.StrokeShape is RoundRectangle with {radius} radius";
    }
}
  1. Build and run
  2. Click on "increase" and "decrease" buttons few times
    Expected: rendering of border corners changes reflecting new CornerRadius
    Actual: rendering of border corners does not change

Link to public reproduction project repository

n/a

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows, I was not able test on other platforms

Affected platform versions

Win 22H2

Did you find any workaround?

No response

Relevant log output

No response

@etvorun etvorun added the t/bug Something isn't working label Mar 16, 2023
@jsuarezruiz jsuarezruiz self-assigned this Mar 16, 2023
@ghost ghost added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Mar 16, 2023
@jsuarezruiz jsuarezruiz added platform/windows 🪟 and removed legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor labels Mar 16, 2023
@jsuarezruiz jsuarezruiz added this to the Backlog milestone Mar 16, 2023
@ghost
Copy link

ghost commented Mar 16, 2023

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

@Eilon Eilon added legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing and removed legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor labels Mar 16, 2023
jsuarezruiz added a commit that referenced this issue Mar 21, 2023
@jsuarezruiz jsuarezruiz moved this from Todo to In Progress in MAUI SDK Ongoing Mar 21, 2023
rmarinho pushed a commit that referenced this issue Mar 22, 2023
* Correctly propagate BindingContext to Border StrokeShape

* Added unit test

* Auto-format source code

* Fix build errors

* Added more tests

* Created generic WeakNotifyPropertyChangedProxy

* Updated border

* Auto-format source code

* Changes in Border

* Update test

* Fix broken tests

* Added sample to validate #13988

---------

Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>
@github-project-automation github-project-automation bot moved this from In Progress to Done in MAUI SDK Ongoing Mar 22, 2023
@samhouts samhouts added the fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149! label Apr 12, 2023
@ghost ghost locked as resolved and limited conversation to collaborators May 12, 2023
@samhouts samhouts modified the milestones: Backlog, .NET 8 May 24, 2023
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-border Border area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149! platform/windows 🪟 t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants