Juliana Peña
Juliana Peña

Reputation: 884

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?

Upvotes: 1

Views: 1619

Answers (1)

AlexEzh
AlexEzh

Reputation: 621

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

Upvotes: 1

Related Questions