0

Hi All,

I have got one scenario here in which I need to bind a DataGrid to a collection (array, ObservableCollection etc.).
My Collection name is "WarningList" and the code is as follows :-

ViewModel :-

WarningList = {({result.WarningMsgCode, result.WarningColor})}

xaml :-

<data:DataGrid x:Name="gridSystemWarnings" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Grid.RowSpan="2" DataContext="{Binding}" 
                                       IsReadOnly="True" CanUserSortColumns="True" ItemsSource="{Binding WarningList[0][0]}" AutoGenerateColumns="False" Margin="1" 
                                       ScrollViewer.CanContentScroll="True" Height="50" ScrollViewer.VerticalScrollBarVisibility="Auto" 
                                       ScrollViewer.HorizontalScrollBarVisibility="Auto" IsSynchronizedWithCurrentItem="True" HeadersVisibility="None">

                            <data:DataGrid.Columns>
                                <DataGridTextColumn Width="*" Binding="{Binding ., Converter={ssv:DataDecode SYSTEMMSG}, Mode=OneWay}">
                                    <DataGridTextColumn.CellStyle>
                                        <Style TargetType="DataGridCell">
                                            <Setter Property="Background" Value="{Binding Converter={ssv:ColourTranslate {Binding WarningList[0][1]}}}" />
                                        </Style>
                                    </DataGridTextColumn.CellStyle>
                                </DataGridTextColumn>
                            </data:DataGrid.Columns>

                        </data:DataGrid>

The "result.WarningMsgCode" is of type String() array while the "result.WarningColor" is of type Integer() array.
For now, I am getting the message code value but not getting the background color of each cell and also I'm not sure about the code

<Setter Property="Background" Value="{Binding Converter={ssv:ColourTranslate {Binding WarningList[0][1]}}}" />

Please help me as early as possible.

1
Contributor
1
Reply
10
Views
3 Years
Discussion Span
Last Post by KM499
0

Hey, I did this one by creating a class and 2 properties in the same...Thanks anyways :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.