mardi 27 janvier 2015

Need to bind a property in a style at the point that I reference it


Vote count:

0




The style I am using contains several elements, but I will show just the horizontal line in my example code here. The StrokeDashArray of the Line is not defined defined yet.



<Style x:Key="YAxisTitleStyle" TargetType="s:AxisTitle">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Grid>
<Line X2="{Binding ActualWidth, RelativeSource={RelativeSource Self}}"
Stroke="{Binding Path=BorderBrush, RelativeSource={RelativeSource AncestorType={x:Type s:YAxis}}}"
StrokeThickness="2"
StrokeDashArray=""/>
</Grid>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>


I want to define the StrokeDashArray at the point that I use the style.



<YAxis TitleStyle="{StaticResource YAxisTitleStyle}"
BorderBrush="{Binding ElementName=HResitivitySeries, Path=SeriesColor, Converter={StaticResource ColorToBrushConverter}}"/>


I need to somehow bind the StrokeDashArray for the line in the style to the StrokeDashArray property of the HResistvitySeries. I have no idea how to do this binding, or if it is even possible. I was able to take the stroke of the line from the BorderBrush of the YAxis in order to sync the colors, but the YAxis has no property equivalent to a StrokeDashArray, and the HResistivitySeries is not an ancestor of the YAxis.



asked 2 mins ago







Need to bind a property in a style at the point that I reference it

Aucun commentaire:

Enregistrer un commentaire