Note that there are some explanatory texts on larger screens.

plurals
  1. POUse Radial Panel in Listbox, throwing exception VisualTree Single Element
    text
    copied!<p>I have a very simple radial panel with a few dependency properties like so:</p> <pre><code>public static readonly DependencyProperty RadiusProperty = DependencyProperty.Register("Radius", typeof(double), typeof(CircularPanel), new PropertyMetadata(50.0, new PropertyChangedCallback(RadiusChanged))); private static void RadiusChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { ((CircularPanel)sender).Refresh(); } </code></pre> <p>The problem is that whenever I assign this radial panel as the itemspanel of a listbox I get an exception:</p> <p><strong>VisualTree of ItemsPanelTemplate must be a single element.</strong></p> <p>This is how I set the ItemsPanel in XAML:</p> <pre><code>&lt;ItemsPanelTemplate x:Key="ItemsPanelTemplate2"&gt; &lt;WpfApplication7:CircularPanel d:LayoutOverrides="Width, Height" AngleItem="{Binding Angle}" AnimationDuration="75" Radius="0" InitialAngle="90"/&gt; &lt;/ItemsPanelTemplate&gt; &lt;ListBox ItemsPanel="{StaticResource ItemsPanelTemplate2}" ItemContainerStyle="{StaticResource ListBoxItemStyle1}" ItemsSource="{Binding Hosts, Mode=OneWay}" &gt; </code></pre> <p>If I remove the PropertyChangedCallback function of the dependency properties, the panel works but since I cant refresh the panel, whenever I change the collection bound to the listbox, all the items are drawn on top of each other rather than in a circular manner. This is in WPF. I've tried in silverlight and there is no problem there.</p> <p>Appreciate Your Help. Thanks</p>
 

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