删除Wpf Charting Legend

时间:2018-03-11 12:49:36

标签: wpf legend wpftoolkit

任何人都可以帮助使用wpf工具包图表控件吗?

我想删除图表旁边的图例,但我无法找到解决方案。请帮助谢谢。

<Window x:Class="CSV_Reader.Histogram_for_2Pgs"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:CSV_Reader"
    mc:Ignorable="d"
    Title="Histogram_for_2Pgs" SizeToContent="WidthAndHeight" ScrollViewer.CanContentScroll="True">
<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <chartingToolkit:Chart Height="350" Grid.Row="0" Grid.ColumnSpan="3"
        Margin="10,10,10,15" x:Name="ColumnChart1" Title="{Binding}" HorizontalAlignment="Stretch" 
        VerticalAlignment="Stretch" Width="800" >
                <chartingToolkit:ColumnSeries DependentValuePath="Value"  IndependentValuePath="Key" ItemsSource="{Binding}"/>
            </chartingToolkit:Chart>

    <ScrollViewer HorizontalScrollBarVisibility="Auto" 
  VerticalScrollBarVisibility="Auto" Margin="10" Width="Auto" Grid.Row="1" Grid.ColumnSpan="3">
        <ListView x:Name="HistogramLabel" Height="Auto" Width="800"  >
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="Label" Width="50" DisplayMemberBinding="{Binding label}"/>
                    <GridViewColumn Header="Description" Width="auto" DisplayMemberBinding="{Binding description}" />
                    <GridViewColumn Header="Appear" Width="auto" DisplayMemberBinding="{Binding appear}" />
                </GridView>
            </ListView.View>
        </ListView>
    </ScrollViewer>
            <Button x:Name="PrintWindow" Content="Print" HorizontalAlignment="Stretch" Grid.Row="2" Grid.Column="0" Padding="10" Margin="10" Click="PrintWindow_Click"/>
            <Button x:Name="DescFilter" Content="Descending"  HorizontalAlignment="Stretch" Grid.Row="2" Grid.Column="1" Padding="10" Margin="10" Click="Desc_Click"/>
    <Button x:Name="AscFilter" Content="Ascending"   HorizontalAlignment="Stretch" Grid.Row="2" Grid.Column="2" Padding="10" Margin="10" Click="Asc_Click"/>
</Grid>

I wanted to remove the legend in the red circle

提前致谢

I want to remove the circled legend

1 个答案:

答案 0 :(得分:0)

例如:

    xmlns:dv="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    xmlns:dvc="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"

        <dvc:Chart.LegendStyle>
            <Style TargetType="dv:Legend">
                <Setter Property="Width" Value="0"></Setter>
            </Style>
        </dvc:Chart.LegendStyle>