現在、手順http://www.windowsphonegeek.com/articles/Creating-a-WP7-Custom-Control-in-7-Stepsに従っていますか? WP7のためのカスタムコントロールを行う際に。通常のWindows Phone PortraitPage xamlファイル(いくつかのコントロールを組み合わせたもの)でコントロールを作成しましたが、generic.xamlファイル(ResourceDictionaryとして)で動作するように変換する方法がわかりません。これまでのところうまくいきませんでした。カスタムコントロール(generic.xaml)for WP7
変換を行うためにExpression Blendを使用しようとしましたが、それを行う方法がわかりません。
編集:私は自分のコードを掲示しています、それは動的な時間を表示するボックスです。また、Dateを提供するプロパティとボックスの色を追加するプロパティも追加します。
これまでのコードです。
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
xmlns:local="clr-namespace:CereTime">
<!-- Check xmlns:local im case of error -->
<Style TargetType="local:CereT1">
<!-- After specifing the custom properties in .cs file, implement them here -->
<Setter Property="Date" Value="{TemplateBinding Date}" /> <!-- Under check -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:CereT1">
<Canvas Background="YellowGreen" Width="100" Height="100" Name="DateBox" HorizontalAlignment="Left" VerticalAlignment="Top">
<StackPanel Orientation="Vertical" Height="100" Width="100">
<TextBlock Name="Month" Text="Month" Foreground="White" TextAlignment="Center" HorizontalAlignment="Center" FontSize="24" FontWeight="Bold" Margin="0,12,0,0" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,6,0,0">
<TextBlock Name="Date" Text="0" VerticalAlignment="Bottom" Margin="0,0,5,0" FontSize="26.667"/>
<TextBlock Name="No_Name" Text="|" FontSize="26.667" />
<TextBlock Name="Year" Text="Year" Margin="5,0,0,0" FontSize="26.667" />
</StackPanel>
</StackPanel>
</Canvas>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
親切にアドバイスしてください。あなたはResourceDictionaryのにユーザーコントロールのスタイルを移動することができますが、あなたのユーザーコントロールのために、対応するXAMLでそのテンプレートを持つことができたときに おかげで、
に
Application.Resources
タグにを追加することですgeneric.xamlに変換しますか? –