<TextBlock Width="Auto" Height="Auto" Text="{TemplateBinding Content}" TextWrapping="Wrap" HorizontalAlignment="Center" Margin="5,0,0,0" VerticalAlignment="Center" Foreground="#FF000000" x:Name="textBlock"/>
How can I bind to another field/property for the data item? Should I bind to something on the TemplatedParent or is this just impossible?
Thanks! I've provided my full control template below....
<Style x:Key="UnitTypeFieldCellImages" TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
<StackPanel x:Name="stackPanel" Orientation="Horizontal">
<Grid Margin="5,0,0,0" x:Name="grid" Width="32" Height="32">
<Grid Width="32" Height="32" x:Name="policecarimage" Visibility="Visible" HorizontalAlignment="Left" VerticalAlignment="Top">
<!--<Image Source="images/policecar_32.png" Height="32" Width="32" />-->
<Image Source="{StaticResource CopCarIcon}" Height="32" Width="32" />
</Grid>
<Image x:Name="firetruckimage" Source="{StaticResource FireTruckIcon}" Height="32" Width="32" Visibility="Hidden" />
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="Content" Value="FD">
<Setter Property="Visibility" TargetName="policecarimage" Value="Hidden"/>
<Setter Property="Visibility" TargetName="firetruckimage" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Joe Modica "]Hi - Since the DataContext of the CellValuePresenter is set to the DataRecord, you can use a standard binding where the Path parameter is set to the name of the Field/Property you want to bind to off the DataItem property of the DataRecord. (the DataItem property returns the underlying data for the DataRecord) {Binding Path=DataItem.MyFieldName} Joe
Joe
Hi Joe,
and what if I dont know "MyFieldName" because it is covered within a RessourcString. And the xamDataGrid Field is Initialized with
<igDP:Field Label="Status" Name="{Binding Source={StaticResource dm_Status}, Path=Path}"></igDP:Field>
Please look at my Forum request: http://forums.infragistics.com/forums/t/16065.aspx
In this Context, is there another possibility to get the Cell Value in the CellValuePresenteStyle.
something like that
<DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value}" Value="true">
or that
<DataTrigger Binding="{Binding Path=DataItem.{StaticResource dm_Status}.Path}" Value="true"> :))
Many Thanks
Axel
"meverett99" wrote in message news:21876@forums.infragistics.com...I would like to make a cell value presenter control template that displays an icon depending on one value of the bound data item and some text from another property of the bound data item. I know to bind to the content of the field associated with the cellvaluepresenter I can use... <TextBlock Width="Auto" Height="Auto" Text="{TemplateBinding Content}" TextWrapping="Wrap" HorizontalAlignment="Center" Margin="5,0,0,0" VerticalAlignment="Center" Foreground="#FF000000" x:Name="textBlock"/> How can I bind to another field/property for the data item? Should I bind to something on the TemplatedParent or is this just impossible? Thanks! I've provided my full control template below.... <Style x:Key="UnitTypeFieldCellImages" TargetType="{x:Type igDP:CellValuePresenter}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}"> <StackPanel x:Name="stackPanel" Orientation="Horizontal"> <Grid Margin="5,0,0,0" x:Name="grid" Width="32" Height="32"> <Grid Width="32" Height="32" x:Name="policecarimage" Visibility="Visible" HorizontalAlignment="Left" VerticalAlignment="Top"> <!--<Image Source="images/policecar_32.png" Height="32" Width="32" />--> <Image Source="{StaticResource CopCarIcon}" Height="32" Width="32" /> </Grid> <Image x:Name="firetruckimage" Source="{StaticResource FireTruckIcon}" Height="32" Width="32" Visibility="Hidden" /> </Grid> <TextBlock Width="Auto" Height="Auto" Text="{TemplateBinding Content}" TextWrapping="Wrap" HorizontalAlignment="Center" Margin="5,0,0,0" VerticalAlignment="Center" Foreground="#FF000000" x:Name="textBlock"/> </StackPanel> <ControlTemplate.Triggers> <Trigger Property="Content" Value="FD"> <Setter Property="Visibility" TargetName="policecarimage" Value="Hidden"/> <Setter Property="Visibility" TargetName="firetruckimage" Value="Visible"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> http://forums.infragistics.com/forums/p/4617/21876.aspx#21876