Xaml无法创建“X”的实例
发布时间:2020-12-14 01:58:58 所属栏目:Windows 来源:网络整理
导读:我正在尝试在 Windows Phone 7中为我的应用程序创建“设置”页面.我创建了AppSettings类,并从我的MainPage.xaml中引用它.这是我的代码: phone:PhoneApplicationPage x:Class="Shapes4Kids.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/p
我正在尝试在
Windows Phone 7中为我的应用程序创建“设置”页面.我创建了AppSettings类,并从我的MainPage.xaml中引用它.这是我的代码:
<phone:PhoneApplicationPage x:Class="Shapes4Kids.MainPage" 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:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:ShapesSettings;assembly=Shapes4Kids" mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="Portrait" Orientation="Portrait" shell:SystemTray.IsVisible="True"> <phone:PhoneApplicationPage.Resources> <local:AppSettings x:Key="appSettings"></local:AppSettings> </phone:PhoneApplicationPage.Resources> 但是在我引用AppSettings(本地:AppSettings行)的行上,我收到一条错误消息,指出“无法创建AppSettings的实例”. 解决方法
这是因为实例化ApplicationsSettings会引发异常.如果你将以下内容添加到构造函数中,那么你应该没问题;
try { settings = IsolatedStorageSettings.ApplicationSettings; } catch (System.IO.IsolatedStorage.IsolatedStorageException e) { // handle exception } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
- .net – Microsoft Enterprise Library的替代品
- 在Windows系统上启用系统范围的TCP keepalive
- 如何通过Microsoft Windows终端测试我的Internet
- 保存Windows窗体大小
- windows-server-2008-r2 – Slipstream SP1到Win
- 如何在Windows登录提示出现之前运行批处理脚本?
- 我正在寻找适用于Windows的Python 2.7的gevent
- Windows – Powershell DSC:无法获取http流
- 如何在Windows Server 2016中将打印机添加到Acti
- Windows – 运行node.js的Azure辅助角色是否会在
热点阅读