Hi,@Mesh Ka. I think it needs to be sized. The controls in the UserControl are all set in size, and the Border is not set in size, which is consistent with the size of the UserControl. LinearGradientBrush is the background of Border, and Border does not display the set size. Background2 has a display color, but its color range is larger than that of the control when the size is not set, and it is where you cannot see it.
Method1:
<UserControl x:Class="StyleClickedButton.UcHome"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:StyleClickedButton"
xmlns:card="clr-namespace:StyleClickedButton.Custom_Controls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<card:InfoCard Title="Test" Number="1000" Width="200" Height="120" Background1="red" Background2="Blue"
EllipseBackground1="BlueViolet" EllipseBackground2="LightGreen"
Icon="Briefcase"/>
</Grid>
</UserControl>
Method2:
<UserControl x:Class="StyleClickedButton.UcHome"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:StyleClickedButton"
xmlns:card="clr-namespace:StyleClickedButton.Custom_Controls"
mc:Ignorable="d"
d:DesignHeight="100" d:DesignWidth="200">
<Grid>
<!--<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>-->
<card:InfoCard Title="Test" Number="1000" Background1="red" Background2="Blue"
EllipseBackground1="BlueViolet" EllipseBackground2="LightGreen"
Icon="Briefcase"/>
</Grid>
</UserControl>
The result:
If no size is set for the UserControl, the UserControl's size will match the parent control's size. You could click on the UserControl(local:UcHome/) in the xaml code to check its actual size in the designer
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.