時鐘指針不會在設計模式下移動。您需要構建並運行項目才能看到它們移動。
拿到項目建設,我不得不從線106,107,118,135,140,145和150
你可能會發現另一個問題的元素去掉UseLayoutRounding="False"
屬性是WPF沒有按似乎沒有拿起屬性更改事件的CurrentDay
和CurrentMonth
屬性。最簡單的選擇是將它們更改爲依賴屬性:
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); }
}
謝謝。我可以問問你是否可以使用Silverlight應用程序到wpf應用程序? – MMakati 2013-02-12 09:33:27
@ user2061539:不確定你的意思 - 我只是將'UserControl'添加到新的WPF應用程序中,修復了編譯器錯誤('UseLayoutRounding'屬性),然後修復了月/日更新問題。 – 2013-02-12 12:20:34
UserControl意味着您只會添加.xaml和.xaml.cs?我只是將其添加到項目的參考。 – MMakati 2013-02-12 14:43:17