Windows Phone 8 プロジェクトでは、次のように UserControl 内に TChart を作成しています。
Chart.Legend.LegendStyle = LegendStyles.Series;
Chart.Legend.Alignment = LegendAlignments.Bottom;
Chart.Header.Visible = false;
if (Page.ZoomMode)
{
Chart.Aspect.GestureOptions = Steema.TeeChart.Silverlight.Drawing.Aspect.Gestures.PinchAndDrag;
Chart.Aspect.GestureStyle = Steema.TeeChart.Silverlight.Drawing.Aspect.GestureStyles.FullChart;
}
else
{
Chart.Aspect.GestureOptions = Steema.TeeChart.Silverlight.Drawing.Aspect.Gestures.None;
Chart.Aspect.GestureStyle = Steema.TeeChart.Silverlight.Drawing.Aspect.GestureStyles.InChart;
}
var theme = ThemeManager.GetDefaultTChartTheme(Chart.Chart);
theme.Apply();
UserControl は PivotItem 内にあります。アイデアは、ズーム モードでピボットをロックして、チャートがドラッグ アンド ピンチ ジェスチャに応答できるようにすることです。
問題 1: 最初の描画後に Chart.Aspect.GestureStyle および Chart.Aspect.GestureOptions を動的に変更すると、次の例外が発生します。
System.InvalidOperationException: Element is already the child of another element.
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.Collection_AddValue[T](PresentationFrameworkCollection`1 collection, CValue value)
at MS.Internal.XcpImports.Collection_AddDependencyObject[T](PresentationFrameworkCollection`1 collection, DependencyObject value)
at System.Windows.PresentationFrameworkCollection`1.AddDependencyObject(DependencyObject value)
at System.Windows.Controls.UIElementCollection.AddInternal(UIElement value)
at System.Windows.PresentationFrameworkCollection`1.Add(T value)
at Steema.TeeChart.Silverlight.Drawing.TBlockCanvas.ShowImage()
at Steema.TeeChart.Silverlight.TChart.Draw(Rect rect)
at Steema.TeeChart.Silverlight.TChart.MeasureOverride(Size availableSize)
at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Double inWidth, Double inHeight, Double& outWidth, Double& outHeight)
問題 2: 最初の描画がズームを有効にした場合。ピボットをロックした後、すべてが機能しているように見え、画面上でグラフをドラッグできます。しかし、tChart.Series.Clear() の後に新しいシリーズをロードするたびに、レンダリングされた画像が何度も移動します...
誰かが私を助けてくれることを願っています。ありがとうございました!