【问题标题】:A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.ni.dll - windows phone在 mscorlib.ni.dll - windows phone 中发生了“System.IO.FileNotFoundException”类型的第一次机会异常
【发布时间】:2014-03-08 07:51:53
【问题描述】:

在我的 xaml 页面中,当我创建一个复选框时,会出现该错误,但是当它被删除时,该错误就会消失。如果我忽略该错误,它仍然会运行,但我仍然想知道是什么导致该错误出现。我在这里做错了什么?

以下是 xaml 代码:

        <toolkit:DatePicker Name="dateData"  
                            HorizontalAlignment="Center" 
                            Width="456"
                            Background="DarkBlue" 
                            ValueStringFormat="{}{0:D}"
                            Foreground="White"
                            BorderBrush="DarkBlue" 
                            />

        <TextBlock HorizontalAlignment="Left"
                   Text="Title" Margin="18,0,0,0" 
                   />

        <TextBox x:Name="titleTBox"  
                 Text="Add New Title"
                 FontFamily="{StaticResource PhoneFontFamilyLight}"      
                 GotFocus="newToDoTextBox_GotFocus" 
                 Grid.ColumnSpan="3" 
                 BorderBrush="Silver" 
                 />
        <TextBlock HorizontalAlignment="Left"  
            TextWrapping="Wrap" 
            Text="Description" 
            VerticalAlignment="Top" Margin="18,0,0,0"
                   />
        <TextBox
                x:Name="descriptionTBox"   
                Text="Add New Description"
                TextWrapping="Wrap"
                FontFamily="{StaticResource PhoneFontFamilyLight}"                    
                GotFocus="newToDoTextBox_GotFocus" Height="125" 
                BorderBrush="Silver" 
                />

        <CheckBox Name="cBox" 
                  Content="Reminder"/>


        <TextBlock HorizontalAlignment="Left"
                   Name="textRDate"
                   Text="Reminder Date" 
                   Margin="18,0,0,0" 
                   Visibility="Collapsed"
                   />

            <toolkit:DatePicker  
                Name="rDate" 
                HorizontalAlignment="Left" 
                Width="456"
                Visibility="Collapsed"
                />

        <TextBlock HorizontalAlignment="Left"
                   Name="TextTDate"
                   Text="Reminder Time" 
                   Margin="18,0,0,0" 
                   Visibility="Collapsed"
                   />

            <toolkit:TimePicker  Name="rTime" 
                                 HorizontalAlignment="Right" 
                                 Width="456"
                                 Visibility="Collapsed"
                                 />
    </StackPanel>

【问题讨论】:

    标签: c# xaml windows-phone-7 windows-phone-8


    【解决方案1】:

    您需要在 Xaml 文件的 CheckBox 中添加以下代码,或者您可以通过代码来处理...

    Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked"
    

    处理代码MainPage.xaml.cs

        private void CheckBox_Checked(object sender, RoutedEventArgs e)
        {
            //Add code here
    
        }
    
        private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
        {
            //Add code here
        }
    

    希望对你有帮助

    【讨论】:

    • 感谢您的回复。我实际上已经这样做了,还是一样
    【解决方案2】:

    我在尝试从需要在 C# 中访问的 API 中引用 .dll 文件时遇到此错误。您必须绝对确定自己满足了制作参考的所有要求——一般来说,其中一些很容易被忽视:

    您是否有正确的驱动程序,并且在安装后您是否重新启动了机器?

    您引用的文件是否针对您正在构建应用程序以在其上运行的处理器类型? (请参阅有关选择正确主动解决方案平台的说明。这篇文章可能会有所帮助:What does the Visual Studio "Any CPU" target mean?

    尝试验证您引用的文件的依赖关系(它是否需要一些硬件连接?它希望识别或访问什么?)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-25
      • 2013-06-21
      相关资源
      最近更新 更多