Pre loader

WPF SciStockChart Using Checkbox to hide GridLines

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

Hi there,

I am new to the SciChart. Could you please tell me what is the name of “x-Axis” in SciStockChart?
Since from your example, you used SciChartSurface. The Checkbox syntax shows below. The ElementName is xAxis.

CheckBox Margin=”3″ Content=”Draw Major Gridlines” IsChecked=”{Binding ElementName=xAxis, Path=DrawMajorGridLines, Mode=TwoWay}”/>

… …

s:SciChartSurface.XAxis>
s:DateTimeAxis x:Name=”xAxis” VisibleRangeChanged=”OnXVisibleRangeChanged”>
/s:SciChartSurface.XAxis>

But I can not find or change the name property in SciStockChart. Could you please tell me what ElementName should I use? Or if there are other ways to achieve this. Thank you very much!

Version
4.2.3
  • You must to post comments
0
0

Hi Dexin,

The SciStockChart inherits SciChartSurface and adds some defaults for stock chart developers.

To access the XAxis (which is declared internally) and change properties, you do so via the SciStockChart.XAxisStyle property. Have a look here for a code sample.

Let me know if this helps!

Best regards,
Andrew

  • Dexin Wang
    Thank you for your reply! I have seen this sample many times and I know how to change the property in XAxisStyle. I just wanted to know when I use a checkbox, how to bind the “checkbox” to “DrawMajorGridLines” in SciStockChart. Thank you! And your kid is very cute.
  • Andrew Burnett-Thompson
    Bind from style setter to the checkbox or to a property in the view model. e.g. <Setter Property=”DrawMajorGridLines” Value=”{Binding ElementName=myCheckBox, Path=IsChecked, Mode=TwoWay}”/>
  • Dexin Wang
    Hi Andrew, Thank you for your reply! Here I first name the checkbox “myCheckBox” and then bind “DrawMajorGridLines” to “myCheckBox” through setter property like what you said. But it still does not work. The Gridlines are always there. Could you please tell me the reason? Thank you! BTW, we have your license.
  • Dexin Wang
    Thank you Andrew, I solved it in C#.
  • You must to post comments
0
0

Hi Andrew, Thank you for your reply! Here I first name the checkbox “myCheckBox” at left side toolbar and then bind “DrawMajorGridLines” to “myCheckBox” through setter property like what you said. But it still does not work. The Gridlines are always there. Could you please tell me the reason? Thank you!

     <ext:FlyoutMenuButton HorizontalAlignment="Left" Content="XAxis Controls" Padding="0" Style="{StaticResource FlyoutMenuButtonStyle}" ToolTipService.ToolTip="XAxis Controls">
          <ext:FlyoutMenuButton.PopupContent>
              <StackPanel MinWidth="150" Orientation="Vertical">
                  <TextBlock Text="XAxis Controls"/>
                  <CheckBox x:Name="myCheckBox" Margin="3" Content="Draw Major Gridlines"  IsChecked="True" />
              </StackPanel>
          </ext:FlyoutMenuButton.PopupContent>
      </ext:FlyoutMenuButton>

      <s:SciStockChart.XAxisStyle>
          <Style TargetType="s:CategoryDateTimeAxis">
              <Setter Property="DrawMajorGridLines" Value="{Binding ElementName=myCheckBox, Path=IsChecked, Mode=TwoWay}" />
          </Style>
      </s:SciStockChart.XAxisStyle>
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies