开发者

Creating a custom control with arbitrary content in Silverlight

开发者 https://www.devze.com 2023-02-02 03:50 出处:网络
I want to create a custom dialog box-like control in Silverlight for WP7 that I can use this way: <local:Dialog>

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

精彩评论

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