代码之家  ›  专栏  ›  技术社区  ›  MarkKGreenway

Silverlight工具包修改2009年10月来源

  •  1
  • MarkKGreenway  · 技术社区  · 15 年前

    补充道

    已删除我的silverlight应用程序中对的引用 System.Windows.Controls.DataVisualization.Toolkit 并补充说


    然后我更改了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>
    

    在my MainPage.xaml中添加了一个简单的柱形图

    然后运行它




    做记号

    1 回复  |  直到 15 年前
        1
  •  1
  •   Bryant    15 年前

    Silverlight工具包使用一些构建任务将控件模板从单独的xaml文件移到generic.xaml文件中。因为您可能没有这个构建任务(我认为团队已经提供了它),所以您需要在generic.xaml而不是Legend.xaml中进行更改(或者获取构建任务)。

    推荐文章