私は初心者向けの本から wp7 に取り組んでいますが、基本的なチュートリアルの 1 つで、不明な例外が発生しています。
アプリケーション リソース (App.xaml) ファイルで定義されているコントロール テンプレートは次のとおりです。
<Application.Resources>
<Style x:Key="CustomButtonStyle" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
<StackPanel>
<Image Source="Images\image.png" Width="200" Height="300" />
<TextBlock Text="{TemplateBinding Content}" TextAlignment="Center" />
</StackPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Application.Resources>
次に、このテンプレートを使用するボタンを作成すると、たとえば
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Button x:Name="CustomButton" Width="250" Height="350" Content="Custom Button" Style="{StaticResource CustomButtonStyle}" />
</Grid>
不明な例外が常に発生します。まで絞り込みました
Text="{TemplateBinding Content}"
コントロール テンプレートの属性ですが、例外があるのはなぜですか? そこにコンテンツがあり、文字列形式です。他に何があるかわかりませんか?プロジェクトを作成するときは、Windows Phone 7.1 をターゲットにしています。私が知らない変化はありましたか?どんな助けでも大歓迎です。ありがとうジョー