Did you know - You can set the Resource for any control directly from VS2010 designer

by rahul 7/2/2010 6:01:00 PM

In a Silverlight application, Create a resource in App.xaml. Something like this…

    <Application.Resources>
        <RadialGradientBrush x:Key="GreenRadialBrush" >
            <GradientStop Color="DarkGreen" Offset="0" />
            <GradientStop Color="White" Offset="1" />
        </RadialGradientBrush>
        <LinearGradientBrush x:Key="SampleLinearBrush" >
            <GradientStop Color="#443344" Offset="0" />
            <GradientStop Color="#778899" Offset="1" />
        </LinearGradientBrush>
    </Application.Resources>

Go back to mainpage.xaml and draw a rectangle or any control for that matter. Switch to properties for the control and look for Fill (or Brushes -> Fill). Right click on Fill and select Apply Resource

image

Notice, how it shows all the Resources and the preview as a swatch!

image

 

Cheers,
Rahul


Quote of the day:
The scientific theory I like best is that the rings of Saturn are composed entirely of lost airline luggage. - Mark Russell


blog comments powered by Disqus

Rahul Soni

Rahul Soni  Twitter

 LinkedIn

 Facebook

 Email me



Vivek Kumbhar

Vivek Kumbhar  Twitter

 LinkedIn

 Facebook

 Email me


Stack Exchange

profile for Vivek at Server Fault, Q&A for system administrators and IT professionals

profile for Rahul Soni at Stack Overflow, Q&A for professional and enthusiast programmers

Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar

All Items
Sign in

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2012, Rahul Soni

Powered by BlogEngine.NET 1.4.5.0