SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

Answered
0
0

Hi,

Our current ThemeManager setup from Infragistics is overriding my TickLabelStyle to have my NumericTickLabel TextBlocks to have the same foreground as the application wide theme, which is not what I want. I’m trying to get around this problem and so far I’ve tried setting a style targeting Textboxes under the AxisStyle, the TickLabelStyle, the SciChartSurface, even tried making an attached behaviour that searches for NumericTickLabels in the surface to set the colors manually. Nothing so far has worked.

I did notice however that my Annotations (Which I have templated to have TextBlocks instead of a TextBox) doesn’t have this problem and can keep their assigned color.

I’m now trying to template the NumericTickLabel to force it to have the colors that I want, but I can’t find how it was Templated in SciChart to begin with. Any other solution that might work would also be acceptable.

To get an idea of the problem here’s a blog post on Infragistics how this problem might be solved in other instances. My specific problem is talked about on Scenario 2

http://www.infragistics.com/community/blogs/andrew_smith/archive/2009/12/09/common-style-issues-when-using-the-theme-property.aspx

But as you can see, NumericTickLabels are not defined in the xaml hence, I can’t use the solution on the blog post.

I would appreciate any insight on this as I’ve been banging my head against the wall to solve this issue.

  • You must to post comments
Best Answer
0
0

H Andrew,

Might be Infragistics fault, but I did get around the problem by retemplating the NumericTickLabel and setting each of the TextBlocks their own styles. I don’t know what the “sinificant” TextBlock does though. This also means that I might have to template all the other TickLabels as well.

<ControlTemplate TargetType="{x:Type SciChart:NumericTickLabel}">
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="{Binding Text}">
                                                <TextBlock.Style>
                                                    <Style TargetType="{x:Type TextBlock}"  BasedOn="{StaticResource {x:Type TextBlock}}">
                                                        <Setter Property="Foreground">
                                                            <Setter.Value>
                                                                <Binding Path="Data.GraphThemeOptions.LabelColor" Source="{StaticResource GraphViewModelProxy}" Converter="{StaticResource ColorToSolidBrushConverter}" UpdateSourceTrigger="PropertyChanged"/>
                                                            </Setter.Value>
                                                        </Setter>
                                                    </Style>
                                                </TextBlock.Style>
                                            </TextBlock>

                                            <TextBlock Text="{Binding Exponent}">
                                                <TextBlock.Style>
                                                    <Style TargetType="{x:Type TextBlock}"  BasedOn="{StaticResource {x:Type TextBlock}}">
                                                        <Setter Property="Foreground">
                                                            <Setter.Value>
                                                                <Binding Path="Data.GraphThemeOptions.LabelColor" Source="{StaticResource GraphViewModelProxy}" Converter="{StaticResource ColorToSolidBrushConverter}" UpdateSourceTrigger="PropertyChanged"/>
                                                            </Setter.Value>
                                                        </Setter>
                                                    </Style>
                                                </TextBlock.Style>
                                            </TextBlock>

                                        </StackPanel>
                                    </ControlTemplate>
  • You must to post comments
0
0

It looks to me like its Infragistics fault, and not ours đŸ˜›

Their style is setting properties on TextBlock. It probably has a stylekey which the normal WPF TextBlock picks up and cannot be overridden in a style because of DependencyProperty Precedence. We use TextBlock and hence, they are styled by their theme.

You’ve tried the steps in Styling Axis Labels, Axis Titles, Rotating Axis Labels, but these don’t work because of DependencyProperty Precedence. The only other way is to set the TextBlock.Foreground in code or via an animation.

You can try that in your TickLabelStyle. Don’t use a Setter for foreground, use an Animation with a duration of 0. I’m not joking. If it works, we will send Infragistics the bill. That is a joke đŸ˜‰

Best regards,
Andrew

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.