Results 1 to 7 of 7

Thread: How to create SilverLight Components

  1. #1
    Join Date
    Jan 2010
    Posts
    126

    How to create SilverLight Components

    Hello,
    I'm new to silverlight and I try to create the components I need, I'm silverlight 3. So I put in the file generix.xml the definition of component I want to open wholesale is just a sort of box with a header in which I want to put other components (TextBlock, checkbox, TextBox ...) in design mode. I obviously an associated class, but that is not the issue. After compiling I try to use my device and I can not fill it with items, does not support direct content. In short anybody know how I do to do to help complete this component?

  2. #2
    Join Date
    Mar 2010
    Posts
    184

    Re: How to create SilverLight Components

    It must be mild one thing to do: Create a dependency property in your code behind Content may contain a control. Add a component whose content is ContentPresenter bind at your dependency property. After you should be able to service you in your component like this:
    Code:
    <TestHeaderedPresenter> <TestHeaderedPresenter.Content> 
    <TextBlock Text="test" /> </ TestHeaderedPresenter.Content> 
    </ TestHeaderedPresenter>

  3. #3
    Join Date
    Dec 2009
    Posts
    211

    Re: How to create SilverLight Components

    Or simply that your custom control inherits ContentControl ContentContainer with gender as a grid and you can fill with whatever you want. But do you know that you have in the silverlight control toolkit you ready for this use?

  4. #4
    Join Date
    Jan 2010
    Posts
    126

    Re: How to create SilverLight Components

    In fact since I develop with VS 2010 RC, I can not install the toolkit, then I have a bug that no longer allows me to have some great design practice vs. 2010. But in brief, I also take this part as an exercise and also to have full control of my design. In fact as you explain the logic AC seems hyper, I try to put in place but it's still not working. There's definitely something that I did not properly work out.

  5. #5
    Join Date
    Dec 2009
    Posts
    292

    Re: How to create SilverLight Components

    We need your control inherits ContentControl instead of Control. You can then remove your dependency Main content. Then for your theme in your TextBlock put that in place
    Code:
    <TextBlock X:Name="TXT_Header" Text="{tmpbnd hdtxt}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"> </ TextBlock>
    Finally to view the content of your control you need a ContentPresenter

    Code:
    <ContentPresenter Content="{tmpbnd Content}" Margin="{tmpbnd Padding}" />
    And then everything should be good (as you can remove a lot of code as well).

  6. #6
    Join Date
    Jan 2010
    Posts
    126

    Re: How to create SilverLight Components

    I still have a problem with the TemplateBinding. Whatever the form as soon as I incorporate a notion Text style = "HeaderText TemplateBinding ()" or Header text represents well the dependency property I created in my class AC plant already in design mode with the message "Unknown Text on TextBlock element attribute "... But I checked at a minimum 150,000 times my syntax in mind the CAP \ Tiny nothing helped.

  7. #7
    Join Date
    Aug 2010
    Posts
    25

    Re: How to create SilverLight Components

    If not for the game with the nickel ContentPresenter it works. I simply put a jack in the happy and I do have what I want. For cons the part where I TemplateBinding creates a dependency that I am my class always returns indeed the "error of the previous post.

Similar Threads

  1. How to create .exe file for my silverlight application?
    By Robert Beck in forum Technology & Internet
    Replies: 4
    Last Post: 18-04-2011, 10:45 AM
  2. Why does SilverLight 4 need to create over 2,000 Registry entries?
    By Lyudmyla in forum Technology & Internet
    Replies: 5
    Last Post: 18-04-2011, 10:40 AM
  3. How to create video chat Silverlight 4?
    By Cherkasov in forum Software Development
    Replies: 5
    Last Post: 05-08-2010, 09:25 AM
  4. How to create Template button in Silverlight 2
    By Tweaker in forum Tips & Tweaks
    Replies: 2
    Last Post: 05-08-2010, 12:57 AM
  5. Error: 0x80040708. Unable to create required engine components
    By killerboy in forum Operating Systems
    Replies: 4
    Last Post: 06-04-2009, 05:35 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,309,295.90029 seconds with 17 queries