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
3166
How to setup CellValuePresenter style programmatically with Binding to differrent field
posted

I have dynamic number of columns which are bound to the grid. The columns are pairs Value/State. I want to style the CellValuePresenter  for 'Value' to bind certain dependency properties based on 'State'. Since the number or columns are determined at runtime, I can't do it xaml, I need to do it programmatically.

I have created a sample where I am doing it in xaml.

<igDP:Field Name="OneValue" Label="One" >
    <igDP:Field.Settings>
        <igDP:FieldSettings>
            <igDP:FieldSettings.CellValuePresenterStyle>
                <Style TargetType="{x:Type igDP:CellValuePresenter}" BasedOn="{StaticResource {x:Type igDP:CellValuePresenter}}">
                    <!--NOTE Binding to different field xxxStale 'Path=DataItem.OneStale'-->
                    <Setter Property="Background"
                        Value="{Binding
                        Path=DataItem.OneStale,
                                Converter={StaticResource BooleanToBrushConverter}}"></Setter>
                 </Style>
            </igDP:FieldSettings.CellValuePresenterStyle>
        </igDP:FieldSettings>
    </igDP:Field.Settings>
</igDP:Field>

Note, in the sample the columns are not dynamic.

BindingDifferentFieldToCellValuePresenterStyle.zip
Parents
No Data
Reply Children
No Data