Okay, so there won't only and exclusively be Silverlight related posts on this blog.

I created a new website in Microsoft Visual Studio 2008 and I added a Master Page. I wanted the content of this website to be centered in the browser window so I proceeded to create a CSS stylesheet to assign the usual { margin: 0 auto; } to my main div in the Default page but it just didn't work. I added a page to which I didn't assign a Master Page and it worked fine. After numerous infructuous tries I fell into account that what was causing this, or actually not causing the desired result, was the lack of the DTD reference in the Master Page.

I copied the code from the page without a Master Page assigned to it to my actual Master Page:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

...and it worked like a charm.

Currently rated 2.3 by 4 people

  • Currently 2.25/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

On my previous post I showed an option to cause a message to appear by clicking on a button. I had played for a while in Blend 2.5 with the obvious functions and animations to achieve this but for some reason it didn't work out. For the opacity of the text the xaml in Blend showed errors. Visual Studio 2008 didn't show any errors but it wouldn't debug either. As for the visibility function it just doesn't work when the timeline recording is on. I get a pop up window describing: "Invalid Property Value: The Property Value is not Valid" (I like how it's refrased in case we didn't get it).

Finally I came up with the last resort, playing with a color animation. Only last night I kicked, digged, dzoned, etc. the article with a very nice result since I received useful comments. Sean made me want to give the opacity another try because it really didn't make any sense that it didn't work. He also mentions that it would be more useful in the case of having a video or an image.  So thanks to Sean here is the result:

Currently rated 1.5 by 164 people

  • Currently 1.512196/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

This morning I felt like recreating in Silverlight 2, with Microsoft Blend 2.5 March Preview, a little executable I made in WPF. First of all I listened to some lying-in-a-caribbean-beach-sipping-pineapple-and-grenadine-juice music to tame the frustration without having to drink any alcohol.

Back to the subject. I couldn't manage to make a message appear and disappear at the click of an object because the Visibility option "Hidden" is not available. The solution turned out to be very simple. It is actually a color animation. The initial color of the font is the same as the background. Then in the animation I changed the color to Black for 2 seconds. At 02:01:00 I added a keyframe to turn the text back to its original color. Here is the result:

This animation creates the illusion of a message appearing after being triggered by clicking a button and then disappearing. Notice the fading effect achieved by the 0.1" color animation at the end.

Update 2008 Aug 2: The app doesn't work properly because of an Event Handler issue. Will post solution in the future.

Update 2008 Sep 3: The solution is in my post Fix for: Make text appear and disappear.

Update 2008 Oct 15: The text properties are not found in type "button": in this case TextWrapping ="Wrap" and TextAlignment ="Center". I had to make the button longer so the text would fit. I also added the FontSize property because the default size was too big.

Currently rated 3.3 by 3 people

  • Currently 3.333333/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5