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
630
xamDataPresenter conditional formatting, CVP data trigger
posted

Hi there

I am just trying to get a data trigger to change the CVP image source depending on the value of a field within my bound datasource. The sytax looks ok to me but no dice? Can someone please help me out, code snippet of CVP template below.

   <Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="UserImage1">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
                        <Grid Width="50" Height="50">
                                <Image x:Name="myImage"
    Margin="{TemplateBinding Padding}"
    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
    Source="{DynamicResource BuddyYellow}">        
                                </Image>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <DataTrigger Binding="{Binding Path=Record.DataItem.CareUnit}" Value="ICU" >
                                    <Setter TargetName="myImage" Property="Image.Source" Value="{DynamicResource BuddyBlue}"/>
                                </DataTrigger>
                                <DataTrigger Binding="{Binding Path=Record.DataItem.CareUnit}" Value="HDU" >
                                    <Setter TargetName="myImage" Property="Image.Source" Value="{DynamicResource BuddyBlue}"/>
                                </DataTrigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                </Setter.Value>
            </Setter>
              
            </Style>