好吧,我覺得我使用ControlTemplate哈哈...請教我如何正確使用ControlTemplate? (有人刪除請)
我想要的是模板我的每個用戶控件,因此每個用戶控件將有刪除,保存,取消按鈕。
所以現在我書面方式一些測試...... 儘量讓周圍的一切邊界...
在App.xaml中
<Application.Resources>
<ControlTemplate x:Key="DeleteSaveCancelTemplate">
<Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<Border BorderThickness="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Black">
<ContentPresenter/>
</Border>
</Grid>
</ControlTemplate>
</Application.Resources>
然後在用戶控件:
<UserControl ... Height="150" Width="300" Template="{StaticResource DeleteSaveCancelTemplate}" >
但我看到的只是......黑色......我做錯了什麼?我以爲我應該使用ContentPresenter來顯示內容?
我剛剛意識到這一點,我也嘗試使用ContentPresenter,但它並沒有工作.. – 2012-02-03 21:10:48