私の Windows Phone 7.1 アプリケーションでは、次のように作成されたページがいくつかあります。
<views:EntityListPage x:Class="Ribo.Smart.X.CustomersPage"
x:Name="MainWindow"
xmlns:views="clr-namespace:Ribo.Smart.X.Views"
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:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
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"
xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
mc:Ignorable="d"
d:DesignWidth="480"
d:DesignHeight="768"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
Loaded="MainWindow_Loaded"
SupportedOrientations="Portrait"
Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<views:EntityListPage.Resources>
....
</views:EntityListPage.Resources>
...
</views:EntityListPage>
これは多かれ少なかれ私のビューのコード ビハインドです。
public partial class CustomersPage : EntityListPage
{
public CustomersPage()
{
InitializeComponent();
}
... other stuff here ...
... of course I'm overriding all the methods of the base abstract class ...
... (see the ancestor definition) ...
}
EntityListPage
クラスが次のように定義されている場所:
public abstract class EntityListPage : PhoneApplicationPage
{
... a lot of stuff here! ...
}
このコードを実行すると、すべてが正常に機能し、コンパイル/ビルド エラーも発生しません。
しかし、CustomersPage ビューの XAML デザイナーを開くと、ページのレイアウトを読み込むことができず、次のエラーが表示されます (ただし、プロジェクトに干渉することはありません!)。
Cannot create an instance of "EntityListPage".
デザイナーがレイアウトを表示できず、エラーが発生する理由がわかりませんが、実行時にはすべて正常に動作し、問題や例外はまったくありません!
ありがとうございました!