时钟指针不会在设计模式下移动。您需要构建并运行项目才能看到它们移动。
拿到项目建设,我不得不从线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