2016-04-13 81 views
1

私はSciChartの試用版を使用しており、いくつかのテストを行っています。スクロールスクロールバーとX軸ラベル

X軸の上にスクロールバーを表示する必要があります。

ビジュアルツリーを調査して解析した後、SciChartSurfaceのスタイルを変更し、スタックパネル内に配置された軸とスクロールバーを置き換える予定です。

この正しい解決策ですか? AxisAlignmentがTopの場合、ビジュアルツリーは異なる場合があります。 これが正しい場合は、表面のスタイルはどこで見つけることができますか? Blandはチャートを認識せず、私はそれを使用できません。

答えて

1

私はこれに取り組んでいましたが、軸コントロール自体をテンプレート化することで、XAxisの上にスクロールバーを実現することができます。ここ

はAxisBase制御のデフォルトのコントロールテンプレート(SciChart V4は)

<ControlTemplate TargetType="axes:AxisBase"> 
    <Border Background="{TemplateBinding Background}" 
      BorderBrush="{TemplateBinding BorderBrush}" 
      BorderThickness="{TemplateBinding BorderThickness}" 
      ap:Device.SnapsToDevicePixels="True"> 

     <StackPanel x:Name="PART_AxisContainer" 
        HorizontalAlignment="Stretch" 
        VerticalAlignment="Stretch" 
        Orientation="{Binding AxisAlignment, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay, Converter={StaticResource AxisAlignmentToAxisOrientationConverter}, ConverterParameter=Inverse}" 
        ap:Device.SnapsToDevicePixels="True" 
        apc:AxisLayoutHelper.AxisAlignment="{Binding AxisAlignment, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"> 

      <Grid HorizontalAlignment="Stretch" 
        VerticalAlignment="Stretch" 
        Canvas.ZIndex="1" 
        ap:Device.SnapsToDevicePixels="True" 
        apc:AxisLayoutHelper.IsInsideItem="True"> 

       <themes:AxisPanel x:Name="PART_AxisCanvas" 
            AxisAlignment="{TemplateBinding AxisAlignment}" 
            Background="Transparent" 
            DrawLabels="{TemplateBinding DrawLabels}" 
            DrawMajorTicks="{TemplateBinding DrawMajorTicks}" 
            DrawMinorTicks="{TemplateBinding DrawMinorTicks}" 
            IsLabelCullingEnabled="{TemplateBinding IsLabelCullingEnabled}" 
            MajorTickLineStyle="{TemplateBinding MajorTickLineStyle}" 
            MinorTickLineStyle="{TemplateBinding MinorTickLineStyle}" 
            ap:Device.SnapsToDevicePixels="True"> 

        <Image x:Name="PART_AxisBitmapImage" 
          HorizontalAlignment="Stretch" 
          VerticalAlignment="Stretch" 
          Stretch="Fill" 
          ap:Device.SnapsToDevicePixels="True" /> 

        <Grid x:Name="PART_LabelsCanvas" Margin="{Binding LabelToTickIndent, RelativeSource={RelativeSource FindAncestor, AncestorType=themes:AxisPanel}, Mode=OneWay}"> 
         <themes:TickLabelAxisCanvas AutoFitMarginalLabels="{TemplateBinding AutoFitMarginalLabels}" 
                Background="Transparent" 
                ClipToBounds="False" 
                IsLabelCullingEnabled="{TemplateBinding IsLabelCullingEnabled}" 
                ap:Device.SnapsToDevicePixels="True" /> 
         <themes:TickLabelAxisCanvas AutoFitMarginalLabels="{TemplateBinding AutoFitMarginalLabels}" 
                Background="Transparent" 
                ClipToBounds="False" 
                IsLabelCullingEnabled="{TemplateBinding IsLabelCullingEnabled}" 
                Visibility="Collapsed" 
                ap:Device.SnapsToDevicePixels="True" /> 
        </Grid> 

        <labelProviders:AxisTitle Orientation="{TemplateBinding Orientation}" 
               Style="{TemplateBinding TitleStyle}" 
               Visibility="{Binding Content, RelativeSource={RelativeSource Self}, Converter={StaticResource CollapseIfNullOrEmptyStringConverter}}" /> 
       </themes:AxisPanel> 

       <themes:ModifierAxisCanvas x:Name="PART_ModifierAxisCanvas" 
              HorizontalAlignment="Stretch" 
              VerticalAlignment="Stretch" 
              ap:Device.SnapsToDevicePixels="True" /> 
      </Grid> 

      <ContentPresenter Content="{TemplateBinding Scrollbar}" apc:AxisLayoutHelper.IsOutsideItem="True" /> 
     </StackPanel> 
    </Border> 
</ControlTemplate> 

ここで(コンバータを含む)修正されたテンプレート

<s:DateTimeAxis AxisAlignment="Bottom" 
      AxisTitle="Top Axis" 
      BorderThickness="0,0,0,1" 
      Id="TopAxisId"> 
<s:DateTimeAxis.Resources> 
    <s:AxisAlignmentToAxisOrientationConverter x:Key="AxisAlignmentToAxisOrientationConverter" /> 
    <s:CollapseIfNullOrEmptyStringConverter x:Key="CollapseIfNullOrEmptyStringConverter" /> 
</s:DateTimeAxis.Resources> 
<s:DateTimeAxis.Template> 
    <ControlTemplate TargetType="s:AxisBase"> 
     <Border Background="{TemplateBinding Background}" 
     BorderBrush="{TemplateBinding BorderBrush}" 
     BorderThickness="{TemplateBinding BorderThickness}" 
     s:Device.SnapsToDevicePixels="True"> 

      <StackPanel x:Name="PART_AxisContainer" 
       HorizontalAlignment="Stretch" 
       VerticalAlignment="Stretch" 
       Orientation="{Binding AxisAlignment, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay, Converter={StaticResource AxisAlignmentToAxisOrientationConverter}, ConverterParameter=Inverse}" 
       s:Device.SnapsToDevicePixels="True" 
       s:AxisLayoutHelper.AxisAlignment="{Binding AxisAlignment, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"> 

       <ContentPresenter Content="{TemplateBinding Scrollbar}" /> 

       <Grid HorizontalAlignment="Stretch" 
       VerticalAlignment="Stretch" 
       Canvas.ZIndex="1" 
       s:Device.SnapsToDevicePixels="True" 
       > 

        <s:AxisPanel x:Name="PART_AxisCanvas" 
           AxisAlignment="{TemplateBinding AxisAlignment}" 
           Background="Transparent" 
           DrawLabels="{TemplateBinding DrawLabels}" 
           DrawMajorTicks="{TemplateBinding DrawMajorTicks}" 
           DrawMinorTicks="{TemplateBinding DrawMinorTicks}" 
           IsLabelCullingEnabled="{TemplateBinding IsLabelCullingEnabled}" 
           MajorTickLineStyle="{TemplateBinding MajorTickLineStyle}" 
           MinorTickLineStyle="{TemplateBinding MinorTickLineStyle}" 
           s:Device.SnapsToDevicePixels="True"> 

         <Image x:Name="PART_AxisBitmapImage" 
         HorizontalAlignment="Stretch" 
         VerticalAlignment="Stretch" 
         Stretch="Fill" 
         s:Device.SnapsToDevicePixels="True" /> 

         <Grid x:Name="PART_LabelsCanvas" Margin="{Binding LabelToTickIndent, RelativeSource={RelativeSource FindAncestor, AncestorType=s:AxisPanel}, Mode=OneWay}"> 
          <s:TickLabelAxisCanvas AutoFitMarginalLabels="{TemplateBinding AutoFitMarginalLabels}" 
               Background="Transparent" 
               ClipToBounds="False" 
               IsLabelCullingEnabled="{TemplateBinding IsLabelCullingEnabled}" 
               s:Device.SnapsToDevicePixels="True" /> 
          <s:TickLabelAxisCanvas AutoFitMarginalLabels="{TemplateBinding AutoFitMarginalLabels}" 
               Background="Transparent" 
               ClipToBounds="False" 
               IsLabelCullingEnabled="{TemplateBinding IsLabelCullingEnabled}" 
               Visibility="Collapsed" 
               s:Device.SnapsToDevicePixels="True" /> 
         </Grid> 

         <s:AxisTitle Orientation="{TemplateBinding Orientation}" 
              Style="{TemplateBinding TitleStyle}" 
              Visibility="{Binding Content, RelativeSource={RelativeSource Self}, Converter={StaticResource CollapseIfNullOrEmptyStringConverter}}" /> 
        </s:AxisPanel> 

        <s:ModifierAxisCanvas x:Name="PART_ModifierAxisCanvas" 
             HorizontalAlignment="Stretch" 
             VerticalAlignment="Stretch" 
             s:Device.SnapsToDevicePixels="True" /> 
       </Grid> 


      </StackPanel> 
     </Border> 
    </ControlTemplate> 
</s:DateTimeAxis.Template> 
<s:DateTimeAxis.Scrollbar> 
    <s:SciChartScrollbar Margin="0 3 0 0" /> 
</s:DateTimeAxis.Scrollbar> 
</s:DateTimeAxis> 

はこのコードは、デフォルトのコントロールテンプレートを含んでいますAxisBaseはSciChartですが、2つの重要なアタッチされたプロパティAxisLayoutHelper.IsOutsideItem/IsInsideItemが削除されます。これらのプロパティは、軸の整列に応じてAxis対Scrollbarの順序を調整するために使用されます。それらを削除すると、どこにでもスクロールバーのContentPresenterを置くことができ、そのまま置いておくことができます。

これは答えのためにSciChart WPF

+1

感謝のV4で働いとして試験されます。現在のチックラベルのパフォーマンスの問題と同様に、私は他のソリューションを使用します。私は約100の大きなダニを持っており、DirectXなしでWPFとしてレンダリングし直しています。ラベルを面の内側に移動する計画。 –

+0

こんにちは、私たちは、WPF TextBlockを使ってラベルを作成します。これは、Unicodeテキストやフォント管理を描画するような作業を大幅に簡素化します(これらはすべてDirectXで記述する必要があります)。問題がある場合は、別の質問を開いてください。 –

関連する問題