zac morris Posted February 4, 2008 Report Share Posted February 4, 2008 Hi, I see that the SeriesAttributes.Template property is not a dependency property and so is not accessible through styles. Will this be changed in a future beta or final release? Maybe I just don't have enough docs to understand the design but not being able to use styles to set data templates seems like a hole in the API. Thanks, Zac Morris Link to comment Share on other sites More sharing options...
JuanC Posted February 5, 2008 Report Share Posted February 5, 2008 I tried the following and it seems to work fine <DataTemplate x:Key="RoundedBar"><Rectangle x:Name="Bar" RadiusX="3" RadiusY="3" Width="{Binding Path=W}" Height="{Binding Path=H}" Fill="{Binding Path=Fill}" Stroke="{Binding Path=Stroke}" StrokeThickness="{Binding Path=StrokeThickness}"/><DataTemplate.Triggers><DataTrigger Binding="{Binding Path=Dimmed}"><DataTrigger.Value><sys:Boolean>True</sys:Boolean></DataTrigger.Value><Setter Property="Opacity" Value="0.25" TargetName="Bar" /></DataTrigger></DataTemplate.Triggers></DataTemplate><cfx:LegendBox x:Key="defaultLegend" Visibility="Visible" Background="Yellow" /><cfx:AllSeriesAttributes x:Key="defaultAllSeries" Template="{StaticResource RoundedBar}"><cfx:AllSeriesAttributes.PointLabel><cfx:PointLabelAttributes Visibility="Visible"/></cfx:AllSeriesAttributes.PointLabel></cfx:AllSeriesAttributes><cfx:PlotAreaAttributes x:Key="defaultPlotArea" AxesStyle="Math" Stroke="Red" Background="Cyan"/><Style x:Key="{x:Type cfx:Chart}" TargetType="{x:Type cfx:Chart}"><Setter Property="LegendBox" Value="{StaticResource defaultLegend}" /><Setter Property="AllSeries" Value="{StaticResource defaultAllSeries}" /><Setter Property="PlotArea" Value="{StaticResource defaultPlotArea}" /></Style>Please note that when setting complex objects in styles (Like LegendBox, PlotArea, etc.) you have to define the object as a resource and then use it in the setter. Also note that not all properties will support this, because of the way styling works, the objects being set would be reused in multiple charts but in our model, 2 charts cannot point to the same legendbox/plotarea/AllSeries so we have to clone these objects. We tried to add support for this in properties that have the bigger chance to be styled, it can also be used in the AxisX and AxisY property. Please let us know if there is a particular property that you are trying to style. Regards, JuanC Link to comment Share on other sites More sharing options...
zac morris Posted February 6, 2008 Author Report Share Posted February 6, 2008 Ok, that makes sense. Thanks, Zac Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.