{"id":1310,"date":"2023-07-11T15:03:53","date_gmt":"2023-07-11T14:03:53","guid":{"rendered":"https:\/\/ibex.tech\/csharp\/?p=1310"},"modified":"2023-07-11T15:03:54","modified_gmt":"2023-07-11T14:03:54","slug":"altering-style-dynamically-from-code","status":"publish","type":"post","link":"https:\/\/ibex.tech\/csharp\/uwp-programming-in-c\/styling\/altering-style-dynamically-from-code","title":{"rendered":"Altering Style dynamically from code"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Set StaticResource style of a control dynamically in the code<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\tMyXamlObject.Style = (Style)Application.Current.Resources&#91;\"TextValueLarge1\"];\n\n\/\/Sets the ojects style in the same way as this does in the .xaml file:\n\/\/  &lt;TextBlock x:Name=\"MyXamlObject\" Style=\"{StaticResource TextValueLarge1}\" \/><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Set StaticResource style of a control dynamically in the code<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-1310","post","type-post","status-publish","format-standard","hentry","category-styling"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/1310","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/comments?post=1310"}],"version-history":[{"count":1,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/1310\/revisions"}],"predecessor-version":[{"id":1311,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/1310\/revisions\/1311"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/media?parent=1310"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/categories?post=1310"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/tags?post=1310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}