Hi,
I'm using XamDataGrid and DataSource is XmlDataProvider. My XML is looks like this,
<root>
<Rows>
<Row>
<Day1 IsValidDay="True" IsHoliDay="True"></Day1>
<Day2 IsValidDay="False" IsHoliDay="False"></Day2>
<Day3 IsValidDay="True" IsHoliDay="True"></Day3>
.
<Day30 IsValidDay="True" IsHoliDay="True"></Day30>
</Row>
</Rows>
</root>
I need to show the cell background color in different color when IsValidDay="False" and IsHoliDay="True". How to define the DataTrigger for this? I dont know how to bind the data for DataTrigger. I tried to do something like this,
<Binding Path="DataItem.Childnode[0].Attributes[0].Value" Value="True"/>
However it is doing binding for first Cell. Not for all. So I need to repeat this for 30 thimes. So I'm wondering is there any way i can get the current cell and bind it to all in single statement. any pointer at the right direction will be grealty appriciated.
-Ashwath
I've compeleted this by help of MultiBinding and MultiValueConverter.
Thanks
Thanks for the quick response Alex. However I'm not showing these attributes(IsHoliday and IsValidDay) in the xamdatagrid. I'm showing only Day0,Day1... so Is it possible to access these xml attributes using the Cell[..] collection? attached is the sample project with XMl file what i'm trying out.
Hello Ashwath,
It looks like a better approach would be to target the Cells[...] collection rather than the DataItem.
What you have to do is create a style for the CellValuePresenter and create a DataTrigger which will bind to the cells, for example
<DataTrigger Binding="{Binding Cells[0].Value}" Value="something">
<setter.../>
Note that the Cells collection also has a string indexer, and the string is the Field's Name.