I am learning to use ReactiveUI in WPF. I have an application that has an IObservableCollection which I am binding to a DataGrid.
<DataGrid Grid.Row="3" Grid.ColumnSpan="2" AutoGenerateColumns="False" ScrollViewer.VerticalScrollBarVisibility="Visible" x:Name="validationResults" HorizontalAlignment="Stretch" IsReadOnly="True" SelectionMode="Extended" SelectionUnit="Cell">
<DataGrid.Columns>
<DataGridTextColumn Header="Item Id" x:Name="vrContractID" Binding="{Binding Path=ItemId, Mode=OneWay}" MinWidth="50" />
<DataGridTextColumn Header="Item #" Binding="{Binding Path=ItemNumber, Mode=OneWay}" MinWidth="50"/>
<DataGridCheckBoxColumn Header="Valid?" Binding="{Binding Path=IsValid, Mode=OneWay}" MinWidth="5"/>
<DataGridTextColumn Header="Error Code" Binding="{Binding Path=ErrorCode, Mode=OneWay}" MinWidth="50"/>
<DataGridTextColumn Header="Error Message" Binding="{Binding Path=ErrorMessage, Mode=OneWay}" Width="*"/>
</DataGrid.Columns>
</DataGrid>
I'm trying not to use XAML based binding like I have showed you above however, I'm having issues understanding how to accomplish this style of binding in the code behind file using something like:
this.Bind()
Or this:
this.OneWayBind()
I've had similar issues binding DataTemplates and MultiBinding and this makes me wonder if there is something I'm missing about the design pattern for ReactiveUI/MVVM.
Any help would be appreciated.
PS: If I must bind this using xaml binding - why wouldn't I just do all my binding in xaml? It sort of feels weird to have 2 places where binding can occur.