What is the code for no brush in uwp

Shay Wilner 1,726 Reputation points
2020-04-05T21:12:30.35+00:00

Hi

I have a textbox the backgroung is set to nobrush

the xaml file

 <TextBox x:Name="Titlechart" Background="{x:Null}" >

How to get the same in code c# or vb.net

Thanks

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

Accepted answer
  1. Shay Wilner 1,726 Reputation points
    2020-04-06T07:00:26.137+00:00

    Hi

    null is not declared
    but if found another solution
    .BorderThickness = New Thickness(0, 0, 0, 0)
    .Background = New SolidColorBrush(Windows.UI.Colors.Transparent)


1 additional answer

Sort by: Most helpful
  1. Fay Wang - MSFT 5,196 Reputation points
    2020-04-06T03:29:47.92+00:00

    Hello,

    Welcome to Microsoft Q&A!

    The method "Background="{x:Null}"" means it will create a null brush, and the Background property of TetxBox will get or set a brush that provides the background of the control. So if you want the achieve the same effect in code-behind, you just need to set the Background as null.

    .cs:

    Titlechart.Background = null;
    
    0 comments No comments