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
500
XamDataGrid CellValuePresenter template
posted

I need some help in defining a ControlTemplate for a CellValuePresenter in XAML.  Normally control templates make use of a content presenter of some sort ... what would I use for the cell value presenter?  Basically I have a scenario where a particular field is has an EditorType defined (say a ComboEditor) but in some instances I don't want to show any editor at all - just a blank cell.  Other times I want to show the combo editor as defined.

I've tried this so far:

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

            <Setter Property="Template">

                <Setter.Value>

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

                        <Border BorderBrush="{DynamicResource WPFGridCellBorder}" BorderThickness="0.5,0,0.5,0">

                            <ContentPresenter x:Name="cellContent" Margin="0,2,0,2">

                                <ContentPresenter.Visibility>

                                    <Binding Path="Record.Index" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType={x:Type igDP:DataRecordCellArea}}">

                                        <Binding.Converter>

                                            <local:IndexToVisibilityConverter />

                                        </Binding.Converter>

                                    </Binding>

                                </ContentPresenter.Visibility>

                            </ContentPresenter>

                        </Border>

                    </ControlTemplate>

                </Setter.Value>

            </Setter>

        </Style>