Closed DheerajSaravagi closed 9 years ago
Hi Dheeraj,
It seems that you have not created or declared the Converter that is specified on your binding.
You have to create a converter called LegalEntityTypeToImageConverter, deriving from IValueConverter under a folder called: Converters.
As an example:
class BooleanToVisibilityConverter implements Fayde.Data.IValueConverter { private trueValue: any = Fayde.Visibility.Visible; private falseValue: any = Fayde.Visibility.Collapsed;
get FalseValue(): any { return this.falseValue; }
set FalseValue(value: any) { this.falseValue = value; }
get TrueValue(): any { return this.trueValue; }
set TrueValue(value: any) { this.trueValue = value; }
Convert(value: any, targetType: IType, parameter: any, culture: any): any
{
return value === null ? this.FalseValue : <Boolean>value ? this.TrueValue : this.FalseValue;
}
ConvertBack(value: any, targetType: IType, parameter: any, culture: any): any
{
return value == this.TrueValue ? true : false;
}
} export = BooleanToVisibilityConverter;
In your fayde file you would then add the following to the namespaces:
xmlns:converters="Converters"
and Under
Thanks for your prompt result, that is something wat I am doing but whenever I am putting StaticResource within Itemcontrol then this will prompt me error.
<ItemsControl x:Name="PersonControl" ItemsSource="{Binding Path=SearchResult}" HorizontalContentAlignment="Stretch">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid HorizontalContentAlignment="Stretch" BorderThickness="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="75"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="25"/>
</Grid.RowDefinitions>
<TextBlock Text Source="{Binding LegalEntityTypeKey, Converter={StaticResource LegalEntityTypeToImageConverter}}" />
<Image Source="/images/clients_256.png"
Width="20"
Height="20"
HorizontalAlignment="Center"
VerticalAlignment="Center" Grid.Column="1" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
Can you email me the fayde file. ronnieb@iprolive.com. I will have a look at it quickly to see if there is an issue there. Otherwise, we can ask Brad to have a look at this issue.
This appears like a misunderstanding of StaticResource. StaticResource refers to another object in the logical tree with x:Key="LegalEntityTypeToImageConverter"
. In your posted example. there is no such object. If you've created a class called LegalEntityTypeToImageConverter
, then try adding an instance to the ItemsControl Resources.
<ItemsControl ...>
<ItemsControl.Resources>
<LegalEntityTypeToImageConverter x:Key="legalEntityTypeToImageConverter" />
</ItemsControl.Resources>
</ItemsControl>
Then use {StaticResource legalEntityTypeToImageConverter}
I am trying to use StaticResource for convert Guid value into a image but it gives me error