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!

Answered
1
0

Hi,
I have a SciChartGroup with 2 SciChartSurfaces…
It seems the SciChartGroup is adding the surface Title on its own somewhere.
What do I have to do to not display the 2nd surfaces title in white in the top-left corner?
Thanks!

Here is a screenshot of what I’d like to remove:

enter image description here

(I’d attach the project, but the buttons on the ask page aren’t attaching anything – in chrome anyway…)

Here is the codebehind:

using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows;
using System.Windows.Input;
using Abt.Controls.SciChart;
namespace nameOn2ndSurface
{
    public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
    }
}
public class datamodel : INotifyPropertyChanged
{
    #region PropertyChanged

    public event PropertyChangedEventHandler PropertyChanged;
    protected void OnPropertyChanged(PropertyChangedEventArgs e)
    {
        if (PropertyChanged != null)
            PropertyChanged(this, e);
    }
    protected void notifyPropertyChanged(string propertyName)
    {
        PropertyChangedEventArgs e = new PropertyChangedEventArgs(propertyName);
        OnPropertyChanged(e);
    }

    #endregion

    ObservableCollection<DataModelGraph> graphs;

    public datamodel()
    {
        graphs = new ObservableCollection<DataModelGraph>();
        graphs.Add(new DataModelGraph() { Title = "graph1" });
        graphs.Add(new DataModelGraph() { Title = "graph2" });
    }
    public ObservableCollection<DataModelGraph> Graphs
    {
        get
        {
            return graphs;
        }
    }
}
public class DataModelGraph : IChildPane, INotifyPropertyChanged
{
    #region PropertyChanged

    public event PropertyChangedEventHandler PropertyChanged;
    protected void OnPropertyChanged(PropertyChangedEventArgs e)
    {
        if (PropertyChanged != null)
            PropertyChanged(this, e);
    }
    protected void notifyPropertyChanged(string propertyName)
    {
        PropertyChangedEventArgs e = new PropertyChangedEventArgs(propertyName);
        OnPropertyChanged(e);
    }

    #endregion

    string title;
    public DataModelGraph()
    {
        title = "graph";
    }
    public string Title
    {
        get
        {
            return title;
        }
        set
        {
            if (title != value)
            {
                title = value;
                notifyPropertyChanged("Title");
            }
        }
    }

    public ICommand ClosePaneCommand { get; set; }
    public void ZoomExtents()
    {
    }
}

}

Here is the xaml:

<Window x:Class="nameOn2ndSurface.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:s="http://schemas.abtsoftware.co.uk/scichart" 
    xmlns:local="clr-namespace:nameOn2ndSurface"
    Title="MainWindow" Height="350" Width="525">
<Window.Resources>
    <local:datamodel x:Key="data" />
    <Style TargetType="s:SciChartSurface">
        <Setter Property="Foreground" Value="Red"/>
        <Setter Property="ChartTitle" Value="{Binding Title}"/>
    </Style>
</Window.Resources>
<Grid DataContext="{DynamicResource data}">
    <s:SciChartGroup x:Name="group"
                     ItemsSource="{Binding Graphs}"
                     >
        <s:SciChartGroup.ItemTemplate>
            <DataTemplate>
                <s:SciChartSurface />
            </DataTemplate>
        </s:SciChartGroup.ItemTemplate>
    </s:SciChartGroup>
</Grid>

  • You must to post comments
Best Answer
1
0

Andrew,
Thanks! That finally got it out of there.
I had to remove the z:ThemeBinding reference because I don’t know what to link z: to.

(It may have something to do with:

the code you write as:

         xmlns:s="clr-namespace:Abt.Controls.SciChart"

I have to change to:

         xmlns:s="http://schemas.abtsoftware.co.uk/scichart" 

)
Changing “z:ThemeBinding” to “s:ThemeBinding” isn’t found either.

If I go to C# code, Abt.Controls.SciChart.Common.MarkupExtensions.ThemeBinding does exist though.

This code seems to work for what I need (same as yours, but with a Height binding, Thumb setters commented out and PART_Header visibility=collapsed):

        <Style x:Key="ChartPaneStyle" TargetType="s:SciChartGroupPane">
        <Style.Setters>
            <Setter Property="Height" Value="{Binding PaneViewModel.Height, Mode=TwoWay}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="s:SciChartGroupPane">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            <!--  Splitter  -->
                            <Thumb x:Name="PART_TopSplitter"
                                                                Height="5"
                                                                HorizontalAlignment="Stretch"
                                                                BorderThickness="0,1,0,1"
                                                                Cursor="SizeNS">
                                <!--<Thumb.Style>
                                    <Style TargetType="Thumb">                                            
                                        <Setter Property="Background" Value="{z:ThemeBinding Path=RubberBandFillBrush}" />
                                        <Setter Property="BorderBrush" Value="{z:ThemeBinding Path=RubberBandStrokeBrush}" />                                            
                                    </Style>
                                </Thumb.Style>-->
                            </Thumb>
                            <!--  Surface  -->
                            <ContentPresenter x:Name="PART_ContentHost"
                                                                            Grid.Row="1"
                                                                            Grid.RowSpan="2"
                                                                            Content="{TemplateBinding Content}" />
                            <!--  Header  -->
                            <Grid x:Name="PART_Header" Grid.Row="1" Visibility="Collapsed">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                            </Grid>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style.Setters>
    </Style>

then creating it with this in the grid:

                            <s:SciChartGroup x:Name="group"
                                         ItemsSource="{Binding Graphs}"
                                         ItemContainerStyle="{StaticResource ChartPaneStyle}"
                                         >
...
  • Andrew
    Great :) glad you got it sorted. FYI ThemeBinding exists in namespace Abt.Controls.SciChart.Common.MarkupExtensions in v3.x. I dont believe its included in the xmlns:s="http://schemas.abtsoftware.co.uk/scichart" but you should be able to reference it using a clr namespace = Abt.Controls.SciChart.Common.MarkupExtensions. It allows us to bind to properties in IThemeProvider which is the current set theme. For more info on ThemeProvider, please see https://www.scichart.com/questions/tags/ithemeprovider
  • You must to post comments
1
0

As well as setting ChartPanelViewModel.Title = string.empty to hide the pane title, you can also as you say template the entire SciChartGroup header.

Here is the control template for the SciChartGroupPane (v3.2, v3.3 compatible), you can change it via an implicit style, e.g.

<Style TargetType="scichart:SciChartGroupPane">
   <Style.Setters>
      <Setter Property="Template">
         <Setter.Value>
            <ControlTemplate TargetType="scichart:SciChartGroupPane">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <!--  Splitter  -->
                    <Thumb x:Name="PART_TopSplitter"
                           Height="5"
                           HorizontalAlignment="Stretch"
                           BorderThickness="0,1,0,1"
                           Cursor="SizeNS">
                        <Thumb.Style>
                            <Style TargetType="Thumb">
                                <Setter Property="Background" Value="{z:ThemeBinding Path=RubberBandFillBrush}" />
                                <Setter Property="BorderBrush" Value="{z:ThemeBinding Path=RubberBandStrokeBrush}" />
                            </Style>
                        </Thumb.Style>
                    </Thumb>
                    <!--  Surface  -->
                    <ContentPresenter x:Name="PART_ContentHost"
                                      Grid.Row="1"
                                      Grid.RowSpan="2"
                                      Content="{TemplateBinding Content}" />
                    <!--  Header  -->
                    <Grid x:Name="PART_Header" Grid.Row="1">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                    </Grid>
                </Grid>
            </ControlTemplate>
         </Setter.Value>
      </Setter>
   </Style.Setters>
</Style>

You can make the PART_Header collapsed by setting Visibility=Collapsed on the Grid element named PART_Header.

  • You must to post comments
0
0

That’s a nice tool!
Here’s the drill-down to it (attached as part_header.png)

Images
  • Andrew
    Im on a mission to educate the world about WPF Snoop ;-) In the textbox under System.Windows.Controls.Textblock, type in 'Text', it will filter the properties window. You should be able to find the binding source for the text via the 'delve binding' button. Have a dig. Meanwhile Im going to look too to see if its obvious (or if I am leading you on a wild goose chase)
  • Andrew
    ... Update .. yep found it. see this image. Does this work for you? https://www.scichart.com/wp-content/uploads/2015/03/BindingSoruce.png
  • You must to post comments
0
0

It does remove the title.
I’m using a custom chartmodifier to make the title more configurable (see “Main” and “Graph” on the surfaces top-right corner).
I could make a new property and bind to it instead, but…
Looking at the minimize/close buttons on there, they are overwriting some other ones that collapse the panel I have labelled “Legend”.
Is there any way to just hide the PART_Header altogether?
Attached is a screenshot of what I’m working with…
Thanks! :/

Images
  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.