Skip to content

Material.Avalonia causes the CornerRadius of UserControl to fail to take effect #448

@HandsomeGoldenKnight

Description

@HandsomeGoldenKnight

Usage Information

Material.Avalonia: v3.10.1; Avalonia: 11.2.7

Description

Material.Avalonia causes the CornerRadius of UserControl to fail to take effect.

Reproduction Steps

App.axaml:

<Application
	x:Class="MyAvaloniaApplication.App" 
	xmlns="https://github.com/avaloniaui"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
	xmlns:idcr="using:Dock.Avalonia.Controls.Recycling" xmlns:ids="using:Dock.Settings"
	xmlns:material="clr-namespace:Material.Styles.Themes;assembly=Material.Styles" 
	xmlns:materialIcons="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
	RequestedThemeVariant="Default">
	<!--  "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options.  -->

	<Application.Styles>
		<FluentTheme />
		<material:MaterialTheme BaseTheme="Inherit" PrimaryColor="Purple" SecondaryColor="Lime" />
		<materialIcons:MaterialIconStyles />
	</Application.Styles>
</Application>

MainWindow.axaml:

<Window
	x:Class="MyAvaloniaApplication.Views.MainWindow"
	xmlns="https://github.com/avaloniaui"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:views="clr-namespace:MyAvaloniaApplication.Views"
	xmlns:vm="using:MyAvaloniaApplication.ViewModels"
	Title="MyAvaloniaApplication"
	d:DesignHeight="450"
	d:DesignWidth="800"
	Icon="/Assets/avalonia-logo.ico"
	mc:Ignorable="d">
	<views:MainView BorderBrush="Black" BorderThickness="5" CornerRadius="20" />
</Window>

Expected Behavior

There are 4 rounded corners around UserControl, when I comment out <material:MaterialTheme BaseTheme="Inherit" PrimaryColor="Purple" SecondaryColor="Lime" /> in the app.axaml file
Image

Actual Behavior

There are no rounded corners around UserControl, when I used MaterialTheme.
Image

Regression?

No response

Known Workarounds

After I check the source code, I think CornerRadius="{TemplateBinding CornerRadius}" is missing in
ContentControl.axaml and UserControl.axaml.

P.S. I wonder if it's necessary to redefine UserControl and ContentControl

Anything else?

No response

Could you help with a pull-request?

No

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions