因此,在为 Windows Phone 8 开发应用程序时,我遇到了工具包的以下问题。
编辑:以下是重现问题的页面的完整代码:
<phone:PhoneApplicationPage
x:Class="TestPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<toolkit:DatePicker x:Name="MyDate" />
</Grid>
</phone:PhoneApplicationPage>
这看起来不错,并让用户选择一个日期,但从不更新它的值。单击它后,您将看到日期选择页面。无论您在此页面上做什么,当您返回 DatePicker 时都会设置回今天的日期。
我在另一个页面上成功使用了 DatePicker。这是在我遇到此问题的特定页面上。
我真正的问题是,如何调试这个元素的行为?当您选择另一个日期时,如何确定导致元素不更新的原因?
编辑2:显然我的应用程序还有其他事情发生。因此我需要调试一个正在运行的元素,或者至少找出它为什么没有按照我的预期做。