views:

22

answers:

2

Where would I put my StringFormat={}{0:C} to make the axis label have currency formatting?

<DVC:LinearAxis Orientation="X" Interval="500000" ShowGridLines="True" Minimum="0" >
                                    <DVC:LinearAxis.AxisLabelStyle>
                                        <Style TargetType="DVC:AxisLabel">
                                            <Setter Property="Template">
                                                <Setter.Value>
                                                    <ControlTemplate TargetType="DVC:AxisLabel">
                                                        <TextBlock Text="{TemplateBinding FormattedContent}">
                                                            <TextBlock.LayoutTransform>
                                                                <RotateTransform Angle="60"/>
                                                            </TextBlock.LayoutTransform>
                                                        </TextBlock>
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </DVC:LinearAxis.AxisLabelStyle>
                                </DVC:LinearAxis>
+1  A: 

Not tested, but I think this will do the trick:

<TextBlock Text="{TemplateBinding FormattedContent, StringFormat={}{0:C}}">

(It's the 7th line of your posted code.)

md5sum
Negative, tried that - "The property 'StringFormat' was not found in type 'TemplateBindingExtension'.
knockando
A: 

This could help you http://wpf.codeplex.com/Thread/View.aspx?ThreadId=75399

HTH

Avatar
This lead me to the answer...added <Setter Property="StringFormat" Value="{}{0:C}"/> directly after my <Style TargetType="DVC:AxisLabel"> line of XAML. Thanks!
knockando
If that's the case, then you could probably also put it just in your first line like: `<DVC:LinearAxis StringFormat="{}{0:C}" ...`. I've not worked with that control, but it must have a directly accessible StringFormat property to use a setter like that. Don't forget to mark the answer as accepted if it solved your problem!
md5sum