Pre loader

Tag: DataTemplate

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

1 vote
14k views

I would like to template items of an AxisCollection assigned to a sciChartSurface in binding of an AxisItemCollectionViewModel. But it looks like I cannot do it as Visual Studio won’t compile my tries.

What i am looking for is something like the EEG 16 channel sample. There the ListBoxItems are styled via a template which is bound to a ViewModelItem. The ListBox itsself is bound to a ViewModelCollection. Depending on how many entries there are entries in the listbox.

So I would like to do something like this:

<SciChartSurface.AxisCollection ItemsSource="{Binding MyAxisCollectionViewModels}" ItemTemplate="{StaticResource AxisItemTemplate}" />

Is this possible? I don’t know how many y-axes i will have. They are configurable by the user.

  • Uwe Hafner asked 9 years ago
  • last active 9 years ago
1 vote
7k views

In version 3, I had

<ControlTemplate x:Key="RolloverLabelTemplate" TargetType="s:TemplatableControl">
  <Border Background="#77FFFFFF"
                BorderBrush="{Binding Stroke,
                                      Converter={StaticResource ColorToBrushConverter}}"
                BorderThickness="2"
                CornerRadius="5">
    <!--<StackPanel Margin="5">
                <TextBlock FontSize="12"
                           FontWeight="Bold"
                           Foreground="{Binding Stroke,
                                                Converter={StaticResource ColorToBrushConverter}}"
                           Text="{Binding SeriesName}" />
                <TextBlock FontSize="11"
                           Foreground="{Binding Stroke,
                                                Converter={StaticResource ColorToBrushConverter}}"
                           Text="{Binding Value}" />
            </StackPanel>-->
  </Border>
</ControlTemplate>

  <s:ModifierGroup>
      <s:RolloverModifier x:Name="rolloverModifier"
                                    LineOverlayStyle="{StaticResource RolloverLineStyle}"
                                    DrawVerticalLine="True"
                                    SourceMode="AllSeries"
                                    ShowTooltipOn="MouseLeftButtonDown"
                                    TooltipTemplate="{StaticResource RolloverLabelTemplate}"
                                    ShowAxisLabels="True" />
      <s:SeriesSelectionModifier ReceiveHandledEvents="True" />
    </s:ModifierGroup>

In Version 4, I get the error on the
 TooltipTemplate="{StaticResource RolloverLabelTemplate}"

An object of the type "System.Windows.Controls.ControlTemplate" cannot be applied to a property that expects the type "System.Windows.DataTemplate".

Could I get some help on this please?

Thanks,
-Robert
0 votes
6k views

Hi,

I´ve encountered following problem. My application should visualize variables of a machine. The user can select those variables an organize them in goups. For each group a SciChartSurface should be visualized with the selected variable as DataSeries.

Therefore I created a ViewModel for those groups. Holding them in a ObservableCollection wich is bound to an ItemsControl:

<ItemsControl
        Grid.Row="1"
        Grid.Column="1"
        Grid.ColumnSpan="6"
        HorizontalContentAlignment="Stretch"
        VerticalContentAlignment="Stretch"
        PreviewMouseWheel="XAxis_MouseWheel"
        PreviewMouseUp="ListView_OnMiddleMouseUp"
        d:PreviewKeyDown="ListView_OnPreviewKeyDown"
        d:PreviewKeyUp="ListView_OnPreviewKeyUp"
        ItemsSource="{Binding ChartViewModels}"
        >
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <UniformGrid Columns="1"/>
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
        <ItemsControl.ItemTemplate>
            <DataTemplate DataType="traceControl:ChartViewModel">
                <Grid
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch"
                    >

                    <s:SciChartSurface Loaded="ChartSurface_Loaded" 
                                       Unloaded="ChartSurface_Unloaded"
                                       Background="White"

                                       >

                      <!-- Some other stuff is also in here, modifiers and axissetup -->

                    </s:SciChartSurface>
                </Grid>
            </DataTemplate>
        </ItemsControl.ItemTemplate>

    </ItemsControl>

There is a Refresh-Action. It does clearing the the ViewModel Collection and creating new ViewModels depending on the configuration and fill them in the ViewModel Collection.

If both actionparts (clearing and filling data) were executed together in for example the ICommand of a button, the memory footprint is increasing each time the refresh button is hit.

If the actionparts were executed one by one, e.g. a clear button and a fill button, everything is fine.

Do I miss something?

Thanks in advance!

Markus

p.s. I was not allowed to add Screenshots of dotMemory

Showing 3 results

Try SciChart Today

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

Start TrialCase Studies