文章出處

You should know that Silverlight comes with win form drawing software is different, it has no the label property. So, if you want to let data points shown on the columns. You must use Style property.

 As follows:

 

  1. Set up style on Application

 ColumnSeries series = new ColumnSeries();//Create series

            series.ItemsSource = KPIData;//Bind data

            series.IndependentValueBinding = new System.Windows.Data.Binding("UserName");//Bind Rows

            series.DependentValueBinding = new System.Windows.Data.Binding("Score");//Bind cells

            series.AnimationSequence = AnimationSequence.FirstToLast;//Sequence

            Style style = (Style)Application.Current.Resources["MyColumnDataStyle"];//Get DataPoint labels

 

 2.   Configure Application

Add in App.xaml

 

 <Application.Resources>

        <Style TargetType="charting:ColumnDataPoint" x:Key="MyColumnDataStyle">

            <Setter Property="Template">

                <Setter.Value>

                    <ControlTemplate TargetType="charting:ColumnDataPoint">

                        <Grid>

                            <Rectangle Fill="{TemplateBinding Background}" Stroke="Black"/>

                            <Grid Margin="0 -20 0 0" HorizontalAlignment="Center" VerticalAlignment="Top">

                                <TextBlock Text="{TemplateBinding FormattedDependentValue}" Margin="2"/>

                            </Grid>

                        </Grid>

                    </ControlTemplate>

                </Setter.Value>

            </Setter>

        </Style>

    </Application.Resources>

</Application>

 

 3. Show data points labels

 


文章列表


不含病毒。www.avast.com
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 大師兄 的頭像
    大師兄

    IT工程師數位筆記本

    大師兄 發表在 痞客邦 留言(0) 人氣()