编程语言
首页 > 编程语言> > C#-在WPFToolkit中更改点大小

C#-在WPFToolkit中更改点大小

作者:互联网

我尝试在WPF工具包中更改点大小

<charting:Chart Name="Charts" Margin="87,48,0,0" Grid.Column="1">
        <charting:LineSeries Name="ChartOne" DependentValuePath="Y" IndependentValuePath="X" Title="График функции" AnimationSequence="FirstToLast"/>
        <charting:Chart.Axes>
            <charting:LinearAxis Orientation="Y" Title="Y" ShowGridLines="True" Minimum="0"/>
            <charting:LinearAxis Orientation="X" Title="X" ShowGridLines="True" Minimum="0"/>
        </charting:Chart.Axes>
        <charting:LineSeries.DataPointStyle>
            <Style TargetType="chartingToolkit:LineDataPoint">
                <Setter Property="Width" Value="20"/>
                <Setter Property="Height" Value="20"/>
            </Style>
        </charting:LineSeries.DataPointStyle>
    </charting:Chart>

但我有一个错误“在类型’LineSeries’中找不到可连接属性’DataPointStyle’”
我究竟做错了什么 ?

解决方法:

该代码对我有用

<Window x:Class="WpfApplication1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    Title="MainWindow" Height="350" Width="525">
   <Grid>
    <charting:Chart Name="Charts" Margin="87,48,0,0" Grid.Column="1">

        <charting:Chart.Axes>
            <charting:LinearAxis Orientation="Y" Title="Y" ShowGridLines="True" Minimum="0"/>
            <charting:LinearAxis Orientation="X" Title="X" ShowGridLines="True" Minimum="0"/>
        </charting:Chart.Axes>
        <charting:LineSeries Name="ChartOne" DependentValuePath="Y" IndependentValuePath="X" 
                             Title="График функции" AnimationSequence="FirstToLast">
        <charting:LineSeries.DataPointStyle>
            <Style TargetType="{x:Type charting:LineDataPoint}">
                <Setter Property="Width" Value="20"/>
                <Setter Property="Height" Value="20"/>
            </Style>
        </charting:LineSeries.DataPointStyle>
        </charting:LineSeries>
   </charting:Chart>
</Grid>

标签:wpftoolkit,wpf,c
来源: https://codeday.me/bug/20191121/2048413.html