SilverlightShow: Implicit Styles in Silverlight Comments http://www.silverlightshow.net/ Silverlight articles, Silverlight tutorials, Silverlight videos, Silverlight samples SilverlightShow.net http://www.rssboard.org/rss-specification Argotic Syndication Framework 2008.0.2.0, http://www.codeplex.com/Argotic en-US estoychev@completit.com (Emil Stoychev) Re: Implicit Styles in Silverlight <p>In WPF you can inherit from implicit styles using BasedOn="{StaticResource {x:Type Button}}", will this work in Silverlight (I did implement a TypeExtension using the new markupextension.</p> http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx#comment7577 weitzhandler http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx Fri, 24 Feb 2012 01:09:16 GMT Re: Implicit Styles in Silverlight <p>Hi, cabronek,</p> <p>You are totally right, a default stype with <em>TargetType = "ButtonBase"</em> won't apply to a Button control. It is my fault. Thanks for clarifing that inaccuracy.</p> http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx#comment6312 ppopadiyn http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx Tue, 28 Jun 2011 10:58:53 GMT Re: Implicit Styles in Silverlight <p>Hi,</p> <p>A default style with <em>TargetType="ButtonBase"</em> won't apply to a <em>Button</em> or any other control inheriting from <em>ButtonBase</em>, because, as far as I know, implicit styles are applied only to the exact type specified in the <em>TargetType</em> property. So if you want to have a common style for all types of buttons (<em>Button</em>, <em>RadioButton</em>, <em>CheckBox</em>), I'd suggest creating a style for <em>ButtonBase with a key/name </em>and<em> </em>with all required setters and then creating empty (without setters) implicit styles for every type of button with <em>BasedOn</em> set to the style for <em>ButtonBase</em>.</p> http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx#comment6311 cabronek http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx Mon, 27 Jun 2011 17:30:29 GMT RE: Implicit Styles in Silverlight <p>Hi Kevin</p> <p>If you set the same property in the base and in the derived style, the value from the derived style will be applied.</p> http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx#comment5792 ppopadiyn http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx Tue, 29 Mar 2011 20:33:35 GMT RE: Implicit Styles in Silverlight What if based and derived both style having same property value? http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx#comment5786 Kevin http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx Tue, 29 Mar 2011 09:59:37 GMT RE: Implicit Styles in Silverlight OK. <p>Thank Mr. Ppopadiyn,</p> http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx#comment5747 Kanthesha Murthy http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx Mon, 21 Mar 2011 11:40:28 GMT RE: Implicit Styles in Silverlight Well, probably you can do that via procedural code. However i've never tried declaring styles in the code-behind. I prefer declaring styles in XAML. http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx#comment5736 ppopadiyn http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx Sat, 19 Mar 2011 20:13:43 GMT RE: Implicit Styles in Silverlight <p>Thank Mr. Ppopadiyn,</p> <p>Can we do it in C# code?</p> http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx#comment5726 Kanthesha Murthy http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx Fri, 18 Mar 2011 06:51:02 GMT RE: Implicit Styles in Silverlight <p>Hi <span id="ctl00_cphMiddle_ContentPlaceHolderContent_itemComments_dlstComments_ctl08_lblCommentAuthor">Kanthesha Murthy</span>,</p> <p>Unfortunately, you cannot specify more than one target type at once. However, what you can do is to set a base class for the TargetType. Thus, all controls that derives from that class will be affected. For example, the <em>Button</em> control derives from <em>ButtonBase, </em>and so does the <em>RadioButton</em>. So if you set: TargetType = "ButtonBase", that style will be applied to all controls that inherits ButtonBase. I hope you catched the idea. :)</p> <p>Regards</p> http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx#comment5722 ppopadiyn http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx Thu, 17 Mar 2011 15:03:31 GMT RE: Implicit Styles in Silverlight <p>Hi All</p> <p> I am new to silverlightshow.net. I have a doubt I think I will get answer here</p> <p>My doubt is can we assign same width to many different controls using only one style? ie. can we use more than one</p> <p>TargetType values (TargetType="Button, TextBlock, ...") like this. so that If I change Width in one style it will affect all the controls Which I have listed in TargetType.</p> <p>Thanks in Advance.</p> <p> </p> http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx#comment5721 Kanthesha Murthy http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx Thu, 17 Mar 2011 14:54:34 GMT RE: Implicit Styles in Silverlight 4 <p>Hi ,</p> <p>Explained Nicely</p> http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx#comment5259 GOPINATH http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx Fri, 07 Jan 2011 07:34:30 GMT RE: Implicit Styles in Silverlight 4 How does one get text to wrap in a button control? http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx#comment4586 LostInSpace http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx Tue, 28 Sep 2010 22:48:36 GMT RE: Implicit Styles in Silverlight 4 <p>Hi Theo#</p> <p>I tried to use merged dictionaries and implicit styles, however without success. Obviously in this beta version of SL4, it doesn't work.</p> http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx#comment2948 ppopadiyn http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx Fri, 22 Jan 2010 10:52:43 GMT RE: Implicit Styles in Silverlight 4 Hi, is this supposed to work with merged resource dictionaries as well? I mean define a resource dictionary, include a merged dictionary and add a style based on a style of the merged dictionary. I can't make it work... http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx#comment2914 Theo# http://www.silverlightshow.net/items/Implicit-Styles-in-Silverlight-4.aspx Thu, 14 Jan 2010 14:51:59 GMT