MMakati
MMakati

Reputation: 703

How to use silverlight in WPF application in Microsoft expression blend 4?

I have a template/pattern that I got in http://gallery.expression.microsoft.com/ (Analog sweeping clock - http://gallery.expression.microsoft.com/AnalogSweepingClock) and I want to use on my WPF application using Microsoft Expression Blend 4. Is it possible? My purpose of using a WPF is it allows you to have more windows.

I tried putting adding the .xaml and .cs of the analog class in my WPF application. But it only displays the clock itself but the clock hand is not working.

Can you help me solving this?

Upvotes: 0

Views: 337

Answers (1)

Richard Deeming
Richard Deeming

Reputation: 31248

The clock hands won't move in design mode. You'll need to build and run the project to see them move.

To get the project to build, I had to remove the UseLayoutRounding="False" attribute from the elements on lines 106, 107, 118, 135, 140, 145 and 150.

Another problem you might find is that WPF doesn't seem to pick up the property changed events for the CurrentDay and CurrentMonth properties. The simplest option is to change these to be dependency properties:

public static readonly DependencyProperty CurrentMonthProperty 
   = DependencyProperty.Register("CurrentMonth", 
   typeof(string), typeof(AnalogSweepingClock),
   new PropertyMetadata(null));

public string CurrentMonth
{
   get { return (string)GetValue(CurrentMonthProperty); }
   set { SetValue(CurrentMonthProperty, value); }
}

public static readonly DependencyProperty CurrentDayProperty 
   = DependencyProperty.Register("CurrentDay", 
   typeof(string), typeof(AnalogSweepingClock),
   new PropertyMetadata(null));

public string CurrentDay
{
   get { return (string)GetValue(CurrentDayProperty); }
   set { SetValue(CurrentDayProperty, value); }
}

Upvotes: 1

Related Questions