0

実際にはアプリの機能に影響を与えていないデータ バインディング エラーを解決しようとしています。問題を次のように減らしました。

<Window x:Class="Testing.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    xmlns:local="clr-namespace:Testing"
    mc:Ignorable="d"
    Title="MainWindow" Height="350" Width="525">
<Grid>
    <ScrollViewer Height="40" x:Name="Testing">
        <chartingToolkit:Chart Name="Chart" Width="Auto">
            <chartingToolkit:Chart.Series>
                <chartingToolkit:BarSeries >
                    <chartingToolkit:BarSeries.DataPointStyle>
                        <Style TargetType="chartingToolkit:BarDataPoint">
                            <Setter Property="Height" Value="{Binding Path=Height, ElementName=Testing}"
                                PresentationTraceSources.TraceLevel="High"/>
                        </Style>
                    </chartingToolkit:BarSeries.DataPointStyle>
                </chartingToolkit:BarSeries>
            </chartingToolkit:Chart.Series>
        </chartingToolkit:Chart>
    </ScrollViewer>
</Grid>
</Window>

次のエラーが生成されます。

System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=Height; DataItem=null; target element is 'BarDataPoint' (Name=''); target property is 'Height' (type 'Double')
System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=Height; DataItem=null; target element is 'BarDataPoint' (Name=''); target property is 'Height' (type 'Double')
System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=Height; DataItem=null; target element is 'BarDataPoint' (Name=''); target property is 'Height' (type 'Double')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=Testing'. BindingExpression:Path=Height; DataItem=null; target element is 'BarDataPoint' (Name=''); target property is 'Height' (type 'Double')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=Testing'. BindingExpression:Path=Height; DataItem=null; target element is 'BarDataPoint' (Name=''); target property is 'Height' (type 'Double')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=Testing'. BindingExpression:Path=Height; DataItem=null; target element is 'BarDataPoint' (Name=''); target property is 'Height' (type 'Double')

私は回避策には興味がありません。なぜなら、私がしていることが間違っている理由を理解しているからです。実際のアプリケーションでは、(わずかに異なる) データバインディングでこれらのエラーが発生しますが、正しく機能します。ビジュアル ツリーの外側のいくつかのデータ ポイントにスタイルを適用するチャート ライブラリで何かが起こっているのではないかと疑っていますが、チャートのソース コードにアクセスできないため、さらに調査する方法がわかりません (コードプレックスにはいくつかありますが、DataPointStyle プロパティが見つからなかったため、古くなっているように見えます)。

4

0 に答える 0