views:

267

answers:

1

Silverlight Chart Legend Style

With Silver Light 4 Tool Kit April 2010

Going off various examples I have found on the web, I am trying to set the legend style so the items are side by side. Error returned “cannot find Style Property ‘ItemsPanel’ on the type ‘System.Windows.Controls.DataVisulization.Legend’

<chartingToolkit:Chart.LegendStyle>
   <Style TargetType="visualizationToolkit:Legend">
     <Setter Property="ItemsPanel">
     <Setter.Value>
        <ItemsPanelTemplate>
           <StackPanel Orientation="Horizontal"/>
        </ItemsPanelTemplate>
           </Setter.Value>
     </Setter>
   </Style>
</chartingToolkit:Chart.LegendStyle>

It appears this property is now missing from the Legend class. Does anyone know a good way to achieve the layout I am looking for?

A: 

Mike,

I have a Silverlight application that also uses a custom legend, and I pasted your ItemsPanel Style into my app, and it worked as expected; and no errors were reported. And I have the same version of the toolkit as you do. The only thing I am doing differently, is using the new combined xmlns namespace as follows:

xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"

So try adding this namespace to your XAML, and change visualizationToolkit:Legend to toolkit:Legend. If you want to read more about it, go here Delay's Blog, and search for "Improved XmlnsDefinition support".

Good luck,
Jim, Face to Face Software and YinYangMoney

Jim McCurdy