Style border of popup

1 Answer 466 Views
Popup
Daniel
Top achievements
Rank 1
Silver
Bronze
Daniel asked on 05 Apr 2022, 07:50 AM | edited on 05 Apr 2022, 07:50 AM

Hi,

How I set the red line ?

Thanks,

          

Current:

 

To Be:


 <telerikPrimitives:RadPopup.Popup Margin="10">
                    <telerikPrimitives:RadPopup x:Name="popupError" IsOpen="{Binding IsOpenPopup , Mode=TwoWay}"
                                  IsModal="false"
                                  OutsideBackgroundColor="#6F000000"
                                            Placement="Center">
                        <telerikMauiControls:RadBorder CornerRadius="8"  BorderThickness="1"
                                         BackgroundColor="{DynamicResource SecondaryColor}">
                            <Grid Padding="20"
                                WidthRequest="300"
                                HeightRequest="180">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="40" />
                                    <RowDefinition Height="80" />
                                </Grid.RowDefinitions>
                                <Button Grid.Row="0"
                                    Padding="2"
                                   HorizontalOptions="End"
                                   Text="X"  WidthRequest="30" HeightRequest="30"
                                   Command="{Binding ClosePopupCommand}" 
                                  BackgroundColor="{DynamicResource PrimaryColor}" TextColor="White" />
                                <Label x:Name="labelError" Text="{Binding ErrorMessage, Mode=TwoWay}" Grid.Row="1" TextColor="Black" HorizontalOptions="Center" VerticalOptions="Center"/>
                            </Grid>
                        </telerikMauiControls:RadBorder>
                    </telerikPrimitives:RadPopup>
                </telerikPrimitives:RadPopup.Popup>

1 Answer, 1 is accepted

Sort by
0
Lance | Senior Manager Technical Support
Telerik team
answered on 05 Apr 2022, 01:44 PM

Hello Daniel,

The BorderThickness property of any element in XAML is a Thickness object in .NET.  The values are set in the following order Left, Top, Right, Bottom... please refer to the Microsoft documentation for more detail and examples Thickness Struct | Microsoft Docs.

When you only set a single value, it is a shortcut that sets all 4 number to that same value.

For example, in your code I see:

BorderThickness="1"

Thanks to the XAML compiler, it will turn into this:

BorderThickness = new Thickness(1,1,1,1);

If you want a different size for one of the sides, then you would just use a different value for that side of the Thickness object.

BorderThickness="Left_Value, Top_Value, Right_Value, Bottom_Value"

 

In your screenshot, it looks like you only want a red border on the left side. That means you just set the value for that side and leave the others at 0.

<MyControl BorderThickness="2,0,0,0" BorderColor="Red" />

Regards,
Lance | Manager Technical Support
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Popup
Asked by
Daniel
Top achievements
Rank 1
Silver
Bronze
Answers by
Lance | Senior Manager Technical Support
Telerik team
Share this question
or