Jump to content
Software FX Community

SeriesAttributes.Template property not a dependency property?


zac morris

Recommended Posts

 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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...