Note that there are some explanatory texts on larger screens.

plurals
  1. POLookless controls with multiple children in properties/parts (+ theming)
    primarykey
    data
    text
    <p>I've created a custom control for <a href="http://mahtweets.codeplex.com/" rel="nofollow noreferrer" title="MahTweets">MahTweets</a> which simplifies/unifies the look of each update across the various social network updates we support. In <em>theory</em> it also simplifies how to theme everything, because we can just create a style for the lookless control.</p> <pre><code>public class StatusUpdateView : Control { public static readonly DependencyProperty ButtonsProperty = DependencyProperty.RegisterAttached("Buttons", typeof(object), typeof(StatusUpdateTextbox), new UIPropertyMetadata(null)); } </code></pre> <p>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.</p> <p>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:</p> <pre><code>&lt;MyControl&gt; &lt;MyControl.ContentPartOne&gt; &lt;Button/&gt; &lt;Button/&gt; &lt;Button/&gt; &lt;/MyControl.ContentPartOne&gt; &lt;MyControl.ContentPartTwo&gt; &lt;stackpanel&gt; ... &lt;/stackpanel&gt; &lt;/MyControl.ContentPartTwo&gt; &lt;/MyControl&gt; </code></pre> <p>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 <em>accepts</em> but doesn't know how to present (so it just gives "(collection)", aka object.ToString())</p> <p>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?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload