在Silverlight模板控件中添加Prism内容控件

时间:2015-02-27 11:52:25

标签: silverlight properties module controls prism

我有一个带内容属性的Silverlight模板化控件。

public static readonly DependencyProperty ContentProperty = DependencyProperty.Register(
        "Content", typeof(FrameworkElement), typeof(MyControl), new PropertyMetadata(null));

public FrameworkElement Content
{
    get { return (FrameworkElement)GetValue(ContentProperty); }
    set { SetValue(ContentProperty, value); }
}

Generic.xaml

 <Border x:Name="bContent" CornerRadius="0,7,7,0" HorizontalAlignment="Left" Grid.Column="0" Grid.Row="1">
       <ContentPresenter x:Name="PART_Content" Grid.Row="1" Content="{TemplateBinding Content}" />
 </Border>

现在当我在模板化控件中添加棱镜模块时,我看不到内容?什么错了......?

<local:MyControl>
     <local:MyControl.Content>
          <ContentControl x:Name="myRegion" Regions:RegionManager.RegionName="myRegion" />
     </local:MyControl.Content>
</local:MyControl>

1 个答案:

答案 0 :(得分:0)

您尚未在ContentControl中设置任何内容,ContentControl本身没有任何可见的内容,如果您没有提供任何内容,例如......&#34; Hello World&# 34。

相关问题