On my XAML
i have defined a special style. Here i can access these with my defined resource like:
<TextBox Style="{StaticResource TransparentInput}" Text="Hello World!" [...] />
But how i can set the Style
of an component programatically ?
I wan't to add components programatically like
TextBox test = new TextBox();
test.Text = "Hello World!";
test.Style = [???] //<--- How i set here the static resource "TransparentInput"?
尝试这个:
test.Style = TryFindResource("TransparentInput") as Style;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.