Questions:
0) Am I correct in assuming that the container elelemnt that holds the LegendItems is a StackPanel?
1) If the answer to #0 above is yes, would I modify the control template to change the orientation to horizontal?
2) If I need to modify the template, I'm pretty sure I can't just "add stuff" and expect it to work. What should I do?
0) No, unfortunate to your purposes, the XamWebChart's current Legend uses a Canvas to lay out the legend items. It will search for an element named RootCanvas in the template you provide and expect it to be a Canvas in which to lay out its elements. These layout routines include the auto ellipsis of series labels if there is not enough space for the legend. You can use some trickery to try and use different containers than a canvas with the existing legend control. But you may find it simpler, depending on your requrements, to manually add and remove legend items to a StackPanel or to make a feature request that the Legend control container type be more customizable (http://devcenter.infragistics.com/protected/requestfeature.aspx)
1) see answer for 0.
2) you can add whatever you want (within reason) to a lookless control's template as long as you maintain the essential contract between the logic of the control and its template. In this case, the Legend control makes one contractual demand of its template; that it provide a control of type Canvas named RootElement, that it will position LegendItems into using X,Y positioning, based on its internal layout calculations.
-Graham
We've pretty much abandoned any hope of making this work (project schedule is pushing on us), so you don't have to work on providing an answer.
Okay, starting with the template you provided that allows axis labels, I modified that template to look like this:
... more of the template here <Grid x:Name="RootElement" Background="{TemplateBinding Background}" Margin="{TemplateBinding Padding}" > <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*"/> <ColumnDefinition Width="Auto" MaxWidth="200"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="*"/> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid x:Name="CaptionPanel" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" /> <Grid x:Name="TopLegendPanel" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" > <StackPanel x:Name="TopLegendStackPanel" Orientation="Horizontal" HorizontalAlignment="Center" /> </Grid> ... more of the template here
My problem is that chart.FindName("TopLegendStackPanel") returns null. How do I get to that template part?