Hi,
I have a employee table.
In this table i have field "specialities". in this field i have to display the expertise of the employee.
One emplyee can have multiple specialities. so, i have to display in the single field multiple values...
here, i have to display the images for each speciality... like
Sales specialist -- slaes icon
Recovery Specialist - recovery icon.
etc etc.
if one employee has 4 specialities, i have to display four different icons under specialities column.
if one employee has 2 specialities, i have to display two different icons under specialities column.
I tried different ways....but, not able to make it work.
any help?
My immediate proposal would be to make a style for the item that includes all the possible images, each with the Visiblility defaulted to Collapsed or Hidden. Then use a converter to set the Visibility property of each to either Visible in a data trigger. I did this with one image, so it should be easy for you, assuming the number of images is reasonable. You'd have each one be its own field. Set the maxwidth to keep it from participating in AutoFit and hide the label. You may need to tweak things a bit if you end up with too much "white space" because of hidden icons. Perhaps you'd need to try to bind the width/maxwidth properties? Another approach might be to bind to the Opacity property of the image to show "unused" icons. I've had some good luck with this approach in similar situations. Make sure the property controlling supports change notification if you need to support dynamic UI updates when the underlying data changes.
Some sample code:
<igDP:Field Name="IsTherapyMaintenance"> <igDP:Field.Settings> <igDP:FieldSettings AllowResize="false" CellContentAlignment="ValueOnly" CellValuePresenterStyle="{StaticResource MaintenanceIndicatorStyle}" CellMaxWidth="18" CellMinWidth="18" /> </igDP:Field.Settings></igDP:Field>
Inside my style:
<c:TherapyMaintenanceConverter x:Key="maintenanceConverter" />
<ControlTemplate.Triggers> <DataTrigger Binding="{Binding Path=DataItem, Converter={StaticResource maintenanceConverter}}" Value="True">
<Setter Property="Visibility" TargetName="Image" Value="Visible" /> </DataTrigger></ControlTemplate.Triggers>
My Converter:
internal class TherapyMaintenanceConverter : IValueConverter{ public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { bool result = false;
PatientTherapy patientTherapy = value as PatientTherapy;
if (patientTherapy != null) { result = patientTherapy.IsTherapyMaintenance; }
return result; }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return null; }}