我有以下轉爐低於拋出的運行時錯誤:遇到問題結合DataGridCell送價值與轉換器
System.Windows.Data Warning: 40 : BindingExpression path error: 'Text' property not found on 'object' ''ContentPresenter' (Name='')'. BindingExpression:Path=Content.Text; DataItem='DataGridCell' (Name=''); target element is 'DataGridCell' (Name=''); target property is 'IsTextMatch' (type 'Boolean')
<DataGrid.Resources>
<helpers:SearchValueConverter x:Key="SearchValueConverter" />
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="helpers:SearchBehaviours.IsTextMatch">
<Setter.Value>
<MultiBinding Converter="{StaticResource SearchValueConverter}">
<Binding RelativeSource="{RelativeSource Self}" Path="Content.Text" />
<Binding RelativeSource="{RelativeSource Self}" Path="(helpers:SearchBehaviours.SearchValue)" />
</MultiBinding>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="helpers:SearchBehaviours.IsTextMatch" Value="True">
<Setter Property="Background" Value="Orange" />
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.Resources>
有人能看到的問題是什麼?
您好,您的轉換器被期望對象的數組,即'對象[]值'如果我這樣做我會嘗試強制轉換爲'FrameworkElement',然後強制使用'FrameworkElement.DataContext int或string'。像@Grant Winney說的使用內容。 HTH – XAMlMAX