Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1000145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:27:54+00:00 2026-05-16T07:27:54+00:00

I’ve created a custom control for MahTweets which simplifies/unifies the look of each update

  • 0

I’ve created a custom control for MahTweets which simplifies/unifies the look of each update across the various social network updates we support. In theory it also simplifies how to theme everything, because we can just create a style for the lookless control.

public class StatusUpdateView : Control
{
    public static readonly DependencyProperty ButtonsProperty = 
        DependencyProperty.RegisterAttached("Buttons", 
            typeof(object), 
            typeof(StatusUpdateTextbox),
            new UIPropertyMetadata(null));
}

Lets just say the above is my existing control’s code behind. It has a few other properties but for the large part doesn’t matter.

I’m trying to create a ‘minimal’ theme which hides a lot of the detail, etc, and thats all fine until I get up to the buttons. By moving the buttons (across the networks, buttons change – for example, facebook doesn’t have a “retweet” button) I want to go from a grid to a horizontal stackpanel. I want to be able to use the control something like:

<MyControl>
    <MyControl.ContentPartOne>
        <Button/>
        <Button/>
        <Button/>
    </MyControl.ContentPartOne>
    <MyControl.ContentPartTwo>
        <stackpanel>
        ...
        </stackpanel>
    </MyControl.ContentPartTwo>
</MyControl>

That’d allow the style/theme for the custom control to decide the layout of the buttons.
Using object (and contentpresenter on the presentation side), I’m told that object can only have one child element (so they were wrapped in grid). I tried to be tricky and do List, which it accepts but doesn’t know how to present (so it just gives “(collection)”, aka object.ToString())

What do I need on the controls code behind to accept a list of UI element (ala ListBox, Panels, etc), and how do I present it on the UI side?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:27:54+00:00Added an answer on May 16, 2026 at 7:27 am

    What you’re describing is the standard pattern of an ItemsControl. ItemsControl takes a collection of objects either directly through Items or bound through ItemsSource (in your case the Buttons) and an ItemsPanelTemplate that defines the Panel to use for layout (your StackPanel). When rendering the ItemsControl’s ItemsPresenter then has the ItemsPanel injected into it and filled with the Items. In your case your Items are already Controls so they won’t be wrapped with ContentPresenters so you can even use a Grid and it will respect the Grid.Row and Grid.Column settings on your Buttons since they will be direct children.

    <ItemsControl>
        <Button Content="1" Grid.Column="0"/>
        <Button Content="2" Grid.Column="1" Grid.Row="1"/>
        <Button Content="3" Grid.Column="2"/>
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="50"/>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="30"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="50"/>
                    </Grid.RowDefinitions>
                </Grid>
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
    </ItemsControl>
    

    You can either use ItemsControl directly (or HeaderedItemsControl for an extra piece of Content) or derive from it and add more of your own functionality.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I have a text area in my form which accepts all possible characters from
I'm parsing an XML file, the creators of it stuck in a bunch social

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.