Bind the data source on the WPF interface instead of using the C # code.

Source: Internet
Author: User
<Grid x:Name="myGrid" Loaded="Grid_Loaded" DataContext="{Binding PartOneData}">        <dxc:ChartControl Name="chartControl1" DataSource="{Binding ComplainAnalysisList}">            <dxc:ChartControl.Diagram>                <dxc:XYDiagram2D SeriesDataMember="Key">                    <dxc:XYDiagram2D.SeriesTemplate>                        <dxc:BarSideBySideSeries2D ArgumentDataMember="Key" ValueDataMember="Value" />                    </dxc:XYDiagram2D.SeriesTemplate>                    <dxc:XYDiagram2D.AxisX>                        <dxc:AxisX2D>                        </dxc:AxisX2D>                    </dxc:XYDiagram2D.AxisX>                </dxc:XYDiagram2D>            </dxc:ChartControl.Diagram>            <!--<dxc:ChartControl.Legend>                <dxc:Legend />            </dxc:ChartControl.Legend>-->        </dxc:ChartControl>    </Grid>

You only need to bind a data source to the outermost grid or other space, bind datasource to the chart control, and specify the seriesdatamember, argumentdatamemeber, and valuedatamember of the bar chart in the chart control.


At the beginning, I only found the method of binding through the C # code, because the print template is used in the project, and the template does not have the C # code background. All the tangle issues have been entangled for a long time, after the research, we found that it was so simple. Next we need to study the function of mixing multiple columns and curves in the next chart. We also need to rely on the two Y axes to continue to refuel ......

Bind the data source on the WPF interface instead of using the C # code.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.