Mick Posted February 4, 2010 Report Share Posted February 4, 2010 Is there any way to make this legend box wrap instead of scrolling off-screen? Thank you, Michael Quote Link to comment Share on other sites More sharing options...
JuanC Posted February 5, 2010 Report Share Posted February 5, 2010 If all labels are similar or you do not care about alignment you could change the Panel used by the legend as follows <cfx:Chart.LegendBox> <cfx:LegendBox Visibility="Visible" DockPanel.Dock="Bottom"> <cfx:LegendBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel/> </ItemsPanelTemplate> </cfx:LegendBox.ItemsPanel> <cfx:LegendBox.ContainerStyle> <Style TargetType="{x:Type ItemsControl}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <ItemsPresenter/> </ControlTemplate> </Setter.Value> </Setter> </Style> </cfx:LegendBox.ContainerStyle> </cfx:LegendBox> </cfx:Chart.LegendBox> Note that we are also changing the ContainerStyle, if you do not this ItemsControl will use a ScrollViewer around the panel that would defeat the WrapPanel purpose. If you do care about alignment and have knowledge about the number of items and size of the chart you could use UniformGrid instead. <cfx:Chart.LegendBox> <cfx:LegendBox Visibility="Visible" DockPanel.Dock="Bottom"> <cfx:LegendBox.ItemsPanel> <ItemsPanelTemplate> <UniformGrid Rows="2"/> </ItemsPanelTemplate> </cfx:LegendBox.ItemsPanel> </cfx:LegendBox> </cfx:Chart.LegendBox> When using UniformGrid we do not need to set ContainerStyle. Obviously both solutions are not optimal so starting in build 3688 (which should be available in a couple of days) you will be able to use a custom Chart FX panel called UniformOrientationGrid which will arrange items in a UniformGrid calculating the number of rows/columns automatically. <cfx:Chart.LegendBox> <cfx:LegendBox Visibility="Visible" DockPanel.Dock="Bottom"> <cfx:LegendBox.ItemsPanel> <ItemsPanelTemplate> <cfxControls:UniformOrientationGrid/> </ItemsPanelTemplate> </cfx:LegendBox.ItemsPanel> <cfx:LegendBox.ContainerStyle> <Style TargetType="{x:Type ItemsControl}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <ItemsPresenter/> </ControlTemplate> </Setter.Value> </Setter> </Style> </cfx:LegendBox.ContainerStyle> </cfx:LegendBox> </cfx:Chart.LegendBox> JuanC Quote Link to comment Share on other sites More sharing options...
Mick Posted February 10, 2010 Author Report Share Posted February 10, 2010 Where can I check for updates / new builds? Thank you, Mick Quote Link to comment Share on other sites More sharing options...
JuanC Posted February 10, 2010 Report Share Posted February 10, 2010 You can download the most recent hotfix here Please note that this page will try to update your Chart FX files so if UAC is enabled in your machine you have to run IE as an Administrator. JuanC Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.