0
私はカラムの1つでマルチバインディングを行っているDataGridを持っています。ちょっとした背景 - ユーザーがデータグリッドに表示する単位(度またはラジアン)を選択するコントロール(AngleSelectionControl)があります。下のコードでは、Roll2列は、モデルに格納されている値(度)を表示しています。ロールコラムには、選択した単位(度またはラジアン)での正しい値が表示されます。それはすべて動作します。 Roll2列の値を変更することもできます。ロール列は更新され、選択した単位で表示されます。しかし、ロール列(セル内でダブルクリック)を編集しようとすると、デバッガは「双方向バインディングにパスまたはXPathが必要です」という例外を表示します。私は何が欠けていますか?DataGridカラムを編集しようとすると、「双方向バインディングにパスまたはXPathが必要です。」
<DataGrid Name="StationConfigurationsDataGrid" Grid.Column="1" Height="150" Width="420" CanUserAddRows="True" AutoGenerateColumns="False" Grid.ColumnSpan="2" ItemsSource="{Binding Path=StationConfigurations}" SelectionMode="Single" SelectedItem="{Binding SelectedConfiguration}" ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto">
<DataGrid.Columns>
<DataGridTextColumn MinWidth="100" Width="Auto" Header="Roll">
<DataGridTextColumn.Binding>
<MultiBinding Converter="{StaticResource AngleMultiValueConverter}" ValidatesOnExceptions="True" StringFormat="f" Mode="TwoWay">
<Binding Path="Roll" FallbackValue="-99.99"/>
<Binding Source="{x:Static unitTypes:AngleSelectionType.Degrees}"/>
<Binding ElementName="AngleSelectionControl" Path="DisplayValueType"/>
<Binding ElementName="AngleSelectionControl" Path="ValueFormat"/>
</MultiBinding>
</DataGridTextColumn.Binding>
</DataGridTextColumn>
<DataGridTextColumn MinWidth="100" Width="Auto" Header="Roll2" Binding="{Binding Roll, ValidatesOnExceptions=True, StringFormat=f}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
働いたこと。ありがとう!なぜそれは片方向(読み込み)であり、もう片方ではない(書き込む)のですか? – bsh152s
DataGridでは、実際に編集機能が動作するためのパスをバインドする必要があるためです。 – mm8