0

I'm building an application to calculate some prices for different objects. In my Window I have a DataGrid bound to an ObservableCollection where all the objects are displayed. Additionally I have a checkbox bound to a boolean which on check should change prices to either before or after tax. To do so I've tried using a MultiValueConverter but I can't figure out how to pass the property bound to my checkbox (I know the reason is that BeforeTax is outside of the ItemSource).

<Checkbox IsChecked={Binding BeforeTax}/>
<DataGrid ItemSource={Binding ArticleCollection}>
    <DataGridTextColumn Head="Price">
        <DataGridTextColumn.Binding>
            <MultiBinding Converter="{StaticResource BeforeAfterTaxMultiConverter}"> 
                <Binding Path="Price"/>
                <Binding Path="BeforeTax"/> 
            </MultiBinding>
        </DataGridTextColumn.Binding>
    </DataGridTextColumn>
</DataGrid> 
ChMar
  • 21
  • 4
  • 1
    `IsChecked="{Binding BeforeTax}"` is a strong indication that the property is exposed by the same object as the `ArticleCollection` property. The Binding at the item level would then be `` – Clemens Jul 25 '22 at 11:52
  • @Clemens thank you so much! - I've tried something like this but didn't think of adding the RelativeSource part – ChMar Jul 25 '22 at 18:28
  • 1
    See also https://stackoverflow.com/q/22073740/1136211 – Clemens Jul 25 '22 at 19:28

0 Answers0