Skip to main content
Home Learn Videos Silverlight Videos Building a Skinnable Custom Control, Part 2
Presented by:Jesse Liberty
December 03, 2008 | Duration: 26:38
Login to Rate
:( Error
0 0
Select Your Format
Jesse Liberty continues to explore custom controls in depth; this time taking a detailed look at the Parts and States model, the separation of Look from Logic and the use of Dependency Properties in the application of templates. He goes on to create the Common Visual States as well as custom Visual States for the emerging custom control. See Part 1 of this series here.
Member
13 Points
#1 December 06, 2008 5:28 PM
Thanks Jesse, it really helped me a lot about understand customization of controls.
30 Points
#2 December 07, 2008 12:51 PM
Jesse,
Wow, wow and WOW!
First of all, thank you for taking the time to clarify quite a few concepts. However, I have to say this, that class "StatusControl" looks as if it's carrying the weight of the world on its shoulders. Let's just hope they are good attributes. <smile/>
Also, during the video, I think you may have used the word 'sensual' instead of 'essential' (but I think you said that just to see who was paying attention). <grin/>
This was, as expected, a very good video, but there is still something that's missing; not quite sure yet. However, all those "set" properties for CLR types has been gnawing at me with all the code that needs to be written for them; I ended up writing a special function so that I could do the notify on change in one call, season to taste:
namespace JesseLiberty
{
/// <summary>
/// Callback made when a change is made to a value.
/// </summary>
public delegate void ChangeCallback();
/// Helper used for setting properties and notifying if a change has taken place.
public class Changer
/// Sets the and notify on change.
/// <typeparam name="Type of me"></typeparam>
/// <param name="oldValue">The old value to compare.</param>
/// <param name="newValue">The new value to compare and possibly assign.</param>
/// <param name="call">The callback if a change is actually made.</param>
/// <returns></returns>
public static bool SetAndNotifyOnChange<T>(ref T oldValue, ref T newValue, ChangeCallback call)
bool changed = false;
if ((oldValue == null) && (newValue == null))
changed = false;
}
else if (((oldValue == null) && (newValue != null)) || !oldValue.Equals(newValue))
oldValue = newValue;
changed = true;
if (call != null)
call();
return changed;
#3 December 07, 2008 12:58 PM
Leave it to me to forget to document what it returns in the code comments; however, I think it's obvious by the time you get to the end of the code. *sigh*
Thank you again for another excellent video; I'm eagerly awaiting your book, but I will wait patiently if it needs some time to stew. <grin/>
Cheers!
5 Points
#4 December 12, 2008 7:51 PM
Hi Jesse,
Great videos, I can't wait for the next one.
One question, Does the logic for the custom controls have to reside in separate C# files? Or can I keep the generic.xaml.cs file and place all the logic in there?
Many thanks.
171 Points
#5 December 19, 2008 8:30 PM
Thank you Jesse. Great Series!
119 Points
#6 January 13, 2009 6:24 PM
Very good video as always!
22 Points
#7 April 23, 2009 6:06 PM
great video
Thanks Jesse
17 Points
#8 July 01, 2009 11:52 AM
#Steve Courtney
The logic HAS to be in a separate file i.e. in a separate class
You must be logged in to leave a comment. Click here to log in.