MMCCPaulEden Posted May 26, 2009 Report Share Posted May 26, 2009 Hi The following XAML is taken from your samples app: <cfx:Chart Name="chart1" Border="{x:Static cfx:Borders.Classic}" Palette="{x:Static cfx:Palettes.Basic}" Style="{x:Static cfxmotifs:Simple.Style}"><cfx:Chart.LegendBox><cfx:LegendBox><cfx:LegendBox.ContainerStyle><Style TargetType="{x:Type ItemsControl}"><Style.Setters><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type ItemsControl}"> <Expander Header="Legend Box"><ItemsPresenter /></Expander></ControlTemplate></Setter.Value></Setter></Style.Setters></Style></cfx:LegendBox.ContainerStyle></cfx:LegendBox></cfx:Chart.LegendBox> </cfx:Chart> As I generate charts on the fly at runtime, how can I apply the LegendBox style in c#? Asa sidenode, defaulting carriage returns to paragraphs on this forum makes pasting code hell... Many thanks Paul Quote Link to comment Share on other sites More sharing options...
JuanC Posted May 26, 2009 Report Share Posted May 26, 2009 Move the style into one of your ResourceDictionaries (typically called App.xaml), add a x:Key attribute and then at runtime execute something like chart1.LegendBox.ContainerStyle = (Style) FindResource("CollapsibleLegendStyle"); Regards, JuanC PS: We will research if we can fix the paste behavior. Quote Link to comment Share on other sites More sharing options...
MMCCPaulEden Posted May 26, 2009 Author Report Share Posted May 26, 2009 There does not seem to be a ContainerStyle property off of the LegendBox property on a chart - your code was my first choice of action and I figured I must have been way off. Thanks for looking into the forum thing Paul Quote Link to comment Share on other sites More sharing options...
JuanC Posted May 26, 2009 Report Share Posted May 26, 2009 The ContainerStyle property will not appear on Intellisense but is there and the code I supplied should compile without any issues. Regards, JuanC Quote Link to comment Share on other sites More sharing options...
MMCCPaulEden Posted May 27, 2009 Author Report Share Posted May 27, 2009 Got it - many thanks. Paul 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.