1

我需要对 Silverlight 工具包图表源进行一些更改

我下载了 Silverlight 工具包...将源代码解压缩到一个新目录

将 Controls.DataVisualization.Toolkit.csproj 项目添加到我的解决方案中

删除了我的 silverlight 应用程序中对 System.Windows.Controls.DataVisualization.Toolkit 的引用并添加
了对 Controls.DataVisualization.Toolkit.csproj 项目的项目引用

然后我将 Legend.xaml 更改

<Style TargetType="datavis:Legend">
   <Setter Property="BorderBrush" Value="Lime"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="IsTabStop" Value="False"/>     
    <Setter Property="TitleStyle">
        <Setter.Value>
            <Style TargetType="datavis:Title">
                <Setter Property="Margin" Value="0,5,0,10"/>
                <Setter Property="FontWeight" Value="Bold"/>
                <Setter Property="HorizontalAlignment" Value="Center"/>
            </Style>
        </Setter.Value>
    </Setter>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="datavis:Legend">
                <Border
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Padding="2">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <datavis:Title
                            Grid.Row="0"
                            Content="{TemplateBinding Title}"
                            Style="{TemplateBinding TitleStyle}"/>
                            <TextBlock>Yeah</TextBlock>                      
                    </Grid>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

向我的 MainPage.xaml 添加了一个简单的柱形图

,然后运行它
,在我的 Silverlight 页面中都看不到任何更改。

谢谢马克

_

4

1 回答 1

1

Silverlight Toolkit 使用一些构建任务将控件模板从单独的 xaml 文件中移出到 generic.xaml 文件中。由于您可能没有此构建任务(我认为团队已使其可用),因此您需要在 generic.xaml 而不是 Legend.xaml 中进行更改(或获取构建任务)。

于 2009-11-05T18:15:18.770 回答