RE: Dynamic themes and resources

2010-07-07 Thread Greg Keogh
Chaps, I have some news on this subject.

 

After talking to the client go-between on just when they needed in the way
of custom styling the SL3 app, it seems that the level of skinning provided
by the toolkit themes is way beyond their needs. They need about 6 different
major parts of the various major controls customised (the background, the
footer, header, etc). They don't need the appearance of all text, combos,
list, etc controls customised.

 

I already had the common properties of important controls styled in the
App.xaml, so I moved those setters into a class I called 'ApplicationBinder'
which exposed the various Brushes and misc custom settings as dependency
properties. That binder class is a global resource in the App.xaml so that
it was available to all controls. Once that is done, you can dynamically
change the brushes and the binding will update the appearance all over the
place where the controls are bound.

 

There is no wizardry in this, but it's a reminder of the power of binding.
Rather than put global styles in App.xaml, put them in a global resource
class that you can bind to from anywhere. You then have an instant
lightweight dynamic skinning.

 

I plan to return to the toolkit themes and use them later once I'm on SL4.
But using simple binding to a global resource class is a miracle quick fix
for now.

 

Cheers,

Greg

___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


Re: Dynamic themes and resources

2010-06-21 Thread Stephen Price
+1 for the themes in SL toolkit.

I've not looked at how that works in Silverlight 4.0 though, currently using
SL3. I'm assuming they've not removed the theming stuff with the introduced
implicit styling? (nice to be able to use either and it keeps the
backward compatibility)

cheers,
Stephen

On Mon, Jun 21, 2010 at 1:21 PM, .net noobie  wrote:

> Greg have you looked at the Themes from the SL toolkit
>
> you can make your own and you can theme you entire app just by wrapping the
> mainpage rootlayout grid
>
> then you can just dynamically set this and change the style/theme for your
> app in a single location
>
> On Mon, Jun 21, 2010 at 2:51 PM,  wrote:
>
>>  Greg, not 100% sure about SL as I am more WPF worldly, but I would think
>> you'll likely need to programmatically assign the appropriate
>> ResourceDictionary(s) after login.
>>
>>
>> something.Resources.MergedDictionaries.Add(somesource.GetResourceDictionaryForUser());
>>
>> where 'something' is your app or a particular window or control etc. and
>> 'somesource' is either assembly internal as in Resource files, or a
>> WebService proxy etc?
>>
>> If its a Xaml string from a Web Service you may need to use SL's
>> equivalent of the XamlReader class to read in the String and cast to a
>> ResourceDictionary as follows (at least for WPF):
>>
>> ResourceDictionary rd = XamlReader.Load(s) as ResourceDictionary;
>>   (rd != null)
>> {
>>  //etc, etc
>> }
>>
>> Hope this helps,
>> Dan.
>>
>> *From:* Greg Keogh 
>>  *Sent:* Monday, June 21, 2010 2:17 PM
>> *To:* 'ozSilverlight' 
>> *Subject:* Dynamic themes and resources
>>
>>  Folks, it’s an action-packed day, I just received word that my SL3 app
>> will soon need to have a feature to assign a different appearance and
>> different string resources according to who is authenticated (via the
>> initial login screen).
>>
>>
>>
>> I took precautions to allow the app to have a different appearance and
>> strings in different installations, but I wasn’t really prepared to cater
>> for the more granular approach of changing appearance for different logins.
>>
>>
>>
>> The strings are all in a spreadsheet-style resource file, so that’s only a
>> minor problem for me. However, dynamically changing themes is more
>> frightening as I haven’t needed to do that before. I’ve tried to be neat
>> with my styles and put them in the controls or in the App page, but I feel
>> that to get dynamic themes  in Silverlight I will have to be ultra-strict
>> and use clever binding.
>>
>>
>>
>> I’m just not sure of the best way to structure the styles and templates
>> globally within the app to make theming easier. I’m going to search to web
>> article guidance on this, but I’m keen to hear from anyone who’s done this
>> before and has some tips and tricks to share.
>>
>>
>>
>> Cheers,
>>
>> Greg
>>
>> --
>>
>> ___
>> ozsilverlight mailing list
>> ozsilverlight@ozsilverlight.com
>> http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
>>
>>
>> ___
>> ozsilverlight mailing list
>> ozsilverlight@ozsilverlight.com
>> http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
>>
>>
>
> ___
> ozsilverlight mailing list
> ozsilverlight@ozsilverlight.com
> http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
>
>
___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


RE: Dynamic themes and resources

2010-06-20 Thread TJ
Exactly what I was going to say.

 

Here is the link:

http://www.silverlight.net/content/samples/sl3/toolkitcontrolsamples/run/def
ault.html#/Welcome.xaml

 

Or for SL4:

http://www.silverlight.net/content/samples/sl4/toolkitcontrolsamples/run/def
ault.html

 

If you go and click on the theme browser on the left, you will see that they
do change the look and feel on the run. 

 

Here is the link for downloading the source code: (take a look at the zip
file)

http://silverlight.codeplex.com/releases/view/43528

 

 

 

Regards,

 

TJ Gokcen | Sydney, Australia | Mobile: +61 400 355 811

 

From: ozsilverlight-boun...@ozsilverlight.com
[mailto:ozsilverlight-boun...@ozsilverlight.com] On Behalf Of .net noobie
Sent: Monday, June 21, 2010 3:22 PM
To: ozSilverlight
Subject: Re: Dynamic themes and resources

 

Greg have you looked at the Themes from the SL toolkit

you can make your own and you can theme you entire app just by wrapping the
mainpage rootlayout grid

 

then you can just dynamically set this and change the style/theme for your
app in a single location

On Mon, Jun 21, 2010 at 2:51 PM,  wrote:

Greg, not 100% sure about SL as I am more WPF worldly, but I would think
you'll likely need to programmatically assign the appropriate
ResourceDictionary(s) after login.

 

something.Resources.MergedDictionaries.Add(somesource.GetResourceDictionaryF
orUser());

 

where 'something' is your app or a particular window or control etc. and
'somesource' is either assembly internal as in Resource files, or a
WebService proxy etc?

 

If its a Xaml string from a Web Service you may need to use SL's equivalent
of the XamlReader class to read in the String and cast to a
ResourceDictionary as follows (at least for WPF):

 

ResourceDictionary rd = XamlReader.Load(s) as ResourceDictionary;
  (rd != null)
{
 //etc, etc
}

 

Hope this helps,

Dan.

 

From: Greg Keogh <mailto:g...@mira.net>  

Sent: Monday, June 21, 2010 2:17 PM

To: 'ozSilverlight' <mailto:ozsilverlight@ozsilverlight.com>  

Subject: Dynamic themes and resources

 

Folks, it's an action-packed day, I just received word that my SL3 app will
soon need to have a feature to assign a different appearance and different
string resources according to who is authenticated (via the initial login
screen).

 

I took precautions to allow the app to have a different appearance and
strings in different installations, but I wasn't really prepared to cater
for the more granular approach of changing appearance for different logins.

 

The strings are all in a spreadsheet-style resource file, so that's only a
minor problem for me. However, dynamically changing themes is more
frightening as I haven't needed to do that before. I've tried to be neat
with my styles and put them in the controls or in the App page, but I feel
that to get dynamic themes  in Silverlight I will have to be ultra-strict
and use clever binding.

 

I'm just not sure of the best way to structure the styles and templates
globally within the app to make theming easier. I'm going to search to web
article guidance on this, but I'm keen to hear from anyone who's done this
before and has some tips and tricks to share.

 

Cheers,

Greg

  _  

___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight

 

___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


Re: Dynamic themes and resources

2010-06-20 Thread .net noobie
Greg have you looked at the Themes from the SL toolkit

you can make your own and you can theme you entire app just by wrapping the
mainpage rootlayout grid

then you can just dynamically set this and change the style/theme for your
app in a single location

On Mon, Jun 21, 2010 at 2:51 PM,  wrote:

>  Greg, not 100% sure about SL as I am more WPF worldly, but I would think
> you'll likely need to programmatically assign the appropriate
> ResourceDictionary(s) after login.
>
>
> something.Resources.MergedDictionaries.Add(somesource.GetResourceDictionaryForUser());
>
> where 'something' is your app or a particular window or control etc. and
> 'somesource' is either assembly internal as in Resource files, or a
> WebService proxy etc?
>
> If its a Xaml string from a Web Service you may need to use SL's equivalent
> of the XamlReader class to read in the String and cast to a
> ResourceDictionary as follows (at least for WPF):
>
> ResourceDictionary rd = XamlReader.Load(s) as ResourceDictionary;
>   (rd != null)
> {
>  //etc, etc
> }
>
> Hope this helps,
> Dan.
>
> *From:* Greg Keogh 
>  *Sent:* Monday, June 21, 2010 2:17 PM
> *To:* 'ozSilverlight' 
> *Subject:* Dynamic themes and resources
>
>  Folks, it’s an action-packed day, I just received word that my SL3 app
> will soon need to have a feature to assign a different appearance and
> different string resources according to who is authenticated (via the
> initial login screen).
>
>
>
> I took precautions to allow the app to have a different appearance and
> strings in different installations, but I wasn’t really prepared to cater
> for the more granular approach of changing appearance for different logins.
>
>
>
> The strings are all in a spreadsheet-style resource file, so that’s only a
> minor problem for me. However, dynamically changing themes is more
> frightening as I haven’t needed to do that before. I’ve tried to be neat
> with my styles and put them in the controls or in the App page, but I feel
> that to get dynamic themes  in Silverlight I will have to be ultra-strict
> and use clever binding.
>
>
>
> I’m just not sure of the best way to structure the styles and templates
> globally within the app to make theming easier. I’m going to search to web
> article guidance on this, but I’m keen to hear from anyone who’s done this
> before and has some tips and tricks to share.
>
>
>
> Cheers,
>
> Greg
>
> --
>
> ___
> ozsilverlight mailing list
> ozsilverlight@ozsilverlight.com
> http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
>
>
> ___
> ozsilverlight mailing list
> ozsilverlight@ozsilverlight.com
> http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
>
>
___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


Re: Dynamic themes and resources

2010-06-20 Thread danlazner
Greg, not 100% sure about SL as I am more WPF worldly, but I would think you'll 
likely need to programmatically assign the appropriate ResourceDictionary(s) 
after login.

something.Resources.MergedDictionaries.Add(somesource.GetResourceDictionaryForUser());

where 'something' is your app or a particular window or control etc. and 
'somesource' is either assembly internal as in Resource files, or a WebService 
proxy etc?

If its a Xaml string from a Web Service you may need to use SL's equivalent of 
the XamlReader class to read in the String and cast to a ResourceDictionary as 
follows (at least for WPF):

ResourceDictionary rd = XamlReader.Load(s) as ResourceDictionary;
  (rd != null)
{
 //etc, etc
}

Hope this helps,
Dan.

From: Greg Keogh 
Sent: Monday, June 21, 2010 2:17 PM
To: 'ozSilverlight' 
Subject: Dynamic themes and resources


Folks, it's an action-packed day, I just received word that my SL3 app will 
soon need to have a feature to assign a different appearance and different 
string resources according to who is authenticated (via the initial login 
screen).

 

I took precautions to allow the app to have a different appearance and strings 
in different installations, but I wasn't really prepared to cater for the more 
granular approach of changing appearance for different logins.

 

The strings are all in a spreadsheet-style resource file, so that's only a 
minor problem for me. However, dynamically changing themes is more frightening 
as I haven't needed to do that before. I've tried to be neat with my styles and 
put them in the controls or in the App page, but I feel that to get dynamic 
themes  in Silverlight I will have to be ultra-strict and use clever binding.

 

I'm just not sure of the best way to structure the styles and templates 
globally within the app to make theming easier. I'm going to search to web 
article guidance on this, but I'm keen to hear from anyone who's done this 
before and has some tips and tricks to share.

 

Cheers,

Greg






___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight