RSS

How to get style in code from resource +silverlight

11 Jun

Define style in app file

<Application xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml&#8221;
x:Class=”SetMyLeads.Silverlight.UI.App”
xmlns:telerik=”http://schemas.telerik.com/2008/xaml/presentation&#8221;
xmlns:Telerik_Windows_Controls_MaskedTextBox=”clr-namespace:Telerik.Windows.Controls.MaskedTextBox;assembly=Telerik.Windows.Controls.Input”
xmlns:Telerik_Windows_Controls_Chromes=”clr-namespace:Telerik.Windows.Controls.Chromes;assembly=Telerik.Windows.Controls”
xmlns:sdk=”http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk&#8221;
xmlns:navigation=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation”
xmlns:System_Windows_Controls_Primitives=”clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls”
xmlns:navPrimitive=”clr-namespace:Telerik.Windows.Controls.Primitives;assembly=Telerik.Windows.Controls.Navigation”
xmlns:System=”clr-namespace:System;assembly=mscorlib”
xmlns:docking=”clr-namespace:Telerik.Windows.Controls.Docking;assembly=Telerik.Windows.Controls.Docking”

xmlns:telerikDocking=”clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking”

xmlns:Telerik_Windows_Controls_Primitives=”clr-namespace:Telerik.Windows.Controls.Primitives;assembly=Telerik.Windows.Controls.Navigation”

xmlns:Telerik_Windows_Controls_TabControl=”clr-namespace:Telerik.Windows.Controls.TabControl;assembly=Telerik.Windows.Controls.Navigation”
xmlns:telerikTest=”clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls”>
<Application.Resources>
<!–TextBox Style –>
<Color x:Key=”BackgroundColor”>#FF3D3D3D</Color>
<Color x:Key=”StandardColor”>#FF808080</Color>
<Color x:Key=”HoverColor”>#FFCCCCCC</Color>
<Color x:Key=”PressedColor”>#FFE5E5E5</Color>
<Style TargetType=”telerik:RadMaskedTextBox” x:Key=”DefaultTextBoxStyle”>

<Setter Property=”MaskType” Value=”None”/>
<Setter Property=”Mask” Value=””/>
<Setter Property=”SelectionOnFocus” Value=”CaretToBeginning”/>
<!–<Setter Property=”MaskedText” Value=”” />–>
<Setter Property=”FontSize” Value=”11″ />
<Setter Property=”FontFamily” Value=”Verdana,Times New Roman”  />
<Setter Property=”Foreground” Value=”Black” />
<Setter Property=”SelectionOnFocus” Value=”CaretToBeginning”></Setter>
<Setter Property=”BorderThickness” Value=”1″/>
<Setter Property=”Height” Value=”22″ />
<Setter Property=”TextAlignment” Value=”Left” />
<Setter Property=”HorizontalContentAlignment” Value=”Stretch”/>
<Setter Property=”VerticalAlignment” Value=”Center”/>

<Setter Property=”IsTabStop” Value=”True”/>
<Setter Property=”IsReadOnly” Value=”False”/>
</Style>

</Application.Resources>
</Application>

LabelSr control name

LabelSr.Style = (Style)(Application.Current.Resources[“DefaultLabelLeftStyle”]);

Advertisements
 
Leave a comment

Posted by on June 11, 2012 in Silverlight

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: