开发者

Creating a custom control with arbitrary content in Silverlight

I want to create a custom dialog box-like control in Silverlight for WP7 that I can use this way:

<local:Dialog>
  <StackPanel>
    <TextBlock>Are you sure?</TextBlock>
    <Button Content="Yes" Click="ClickCallback" />
  </StackPanel>
</local:Dialog>

As in, just a simple container that I can add arbitrary content to. I just want to add storyboards for 开发者_运维技巧animations and a backdrop to make the dialog modal, etc. I already have this ready.

What I don't know how to do is add the content. I've read that you have to inherit from ContentControl, but how is this actually implemented?


There are number of good examples on ContentControl usage available in Silverlight Toolkit. For example Frame control located in Source\System.Windows.Controls.Navigation\System\Windows\Controls\Frame.cs

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜