Quantcast
Channel: Henry Cordes, My thoughts exactly... - Create a UserControl with Silverlight 2.0 Beta 1
Viewing all articles
Browse latest Browse all 3

Rob Leclerc on Create a UserControl with Silverlight 2.0 Beta 1

$
0
0
I come from a Java background but for the past few months I've been programming with C# and Silverlight. I've been trying to get my head around Dependency Properties and how one "ought" to structure their code in Silverlight, but all the examples seem to be much more complex than they need to be, and so I feel that must be missing something. For instance, most of the code above could have been written in about 40 lines with something like what you see below. On your follow up post you got into Dependency Properties and this tacked on another 30 lines, but I fail to see how this improved the code in anyway. It's longer, and more complex, and seemingly would be harder to maintain. As long as you have an event handler rigged up, subscribers can be notified of events as they happen and it seems like you are good to go? I don't mean this to sarcastic, as I genuinely feel like I am missing something, but in many example using "advanced" Silverlight techniques, the complexity is a lot greater than it needs to be and I don't see where the nutritional value is. public SolidColorBrush FemaleColor { get; set; } public SolidColorBrush FemaleDisabled { get; set; } public SolidColorBrush MaleColor { get; set; } public SolidColorBrush MaleDisabled { get; set; } public GenderChooser() { InitializeComponent(); FemaleColor = new SolidColorBrush(Color.FromArgb(255, 14, 27, 75); ... } private void MouseLeave(object sender, MouseEventArgs e) { if(sender == FemalePath){ FemalePath.Stroke = FemaleStrokeDisabled; } else if(sender == MalePath){ MalePath.Stroke = MaleStrokeDisabled; } }

Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images