Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
270
Generic CellValuePresenter
posted

 Hi,

I have a XamDataGrid with 5 Columnswich are representing boolean values. Now i want to change the CellLayout for all five columns, so that there is a green or red circle depending on the boolean value.

 So i wrote a CellValuePresenterStyle  as follows:

<Style x:Key="BoolCellStyle" TargetType="{x:Type igDP:CellValuePresenter}">
     <Setter Property="Template">
          <Setter.Value>
                <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
                        //<--CircleDefinition   Name="circle" Fill="Red"-->//

                            <ControlTemplate.Triggers>
                                <DataTrigger Binding="{Binding Path=DataItem.Bool1}" Value="true">
                                    <Setter TargetName="circle" Property="Fill" Value="Green" />
                                </DataTrigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

Adding this style to the Field works fine. But only for column "Bool1" and want to have 5 BooleanColumns looking all identically.But in the DataTrigger of "BoolCellStyle" is an explicit reference to Column "Bool1". Of course, i am able to define 5 different(not really :)) BoolCellStyle's which only difference is the dataTrigger Binding (DataItem.Bool1, DataItem.Bool2, DataItem.Bool3.....). But i dont think that infragistics intend such an approach. So, how it is possible to write ONE cellStyle referencing on the cellValue, without an explicit Binding to a ColumnName.?

Changing the DataTrigger Binding to 

<DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value}" Value="true">

wont work. :( 

I am very pleased for any suggestions to solve this on an elegant way.

 

axel

Parents Reply Children
No Data