问题
I have some changes I need to make to the Silverlight toolkit Charting source
I downloaded the Silverlight toolkit ... unzipped the source to a new directory
Added the Controls.DataVisualization.Toolkit.csproj Project to my Solution
Removed The reference in my silverlight application to
System.Windows.Controls.DataVisualization.Toolkit
and Added
A project Reference to The Controls.DataVisualization.Toolkit.csproj Project
I then changed the Legend.xaml
to
<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>
Added a simple columnchart to my MainPage.xaml
and Then ran it
neither of the changes are visible in my Silverlight Page.
Thanks
Mark
回答1:
The Silverlight Toolkit uses some build tasks to move the control templates out of the seperate xaml files into the generic.xaml file. Since you probably don't have this build task (I think the team has made it available) you will need to make your changes in generic.xaml instead of Legend.xaml (or get the build task).
来源:https://stackoverflow.com/questions/1681207/silverlight-toolkit-modifying-october-2009-source