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
975
Changing Individual Cell Visibility Based On Value
posted

I'm trying to work out how to change a cell's visibility based on it's value. I can do it using a trigger in a fieldlayout, but I want to do it as the record is initialised.

For example, I have 3 columns, and if the first column of a particular row contains a 0, I want to make that first cell, and the third cell blank, rather than displaying their values. Whatever I try to do in code, it seems to make the visibility change for every row rather than the rows that have 0 in the first column.

Am I missing something, or is this only possible using the trigger on the template in the fieldlayout definitions?

Cheers,

Rob

Parents
No Data
Reply
  • 69686
    posted

    Hello Rob,

    I am not sure whether the InitializeRecord event is appropriate for this, as the Presenters are not yet generated.

    However, you can use the following code snippet to achieve this:

    <Style TargetType="{x:Type igDP:CellValuePresenter}">

                        <Style.Triggers>

                            <DataTrigger Binding="{Binding Path=Value, RelativeSource={RelativeSource Self}}" Value="0">

                                <Setter Property="Visibility" Value="Hidden"/>

                            </DataTrigger>

                        </Style.Triggers>

                    </Style>

    Hope this helps.

Children