I'm quite confused as at runtime I get this error: The application called an interface that was marshalled for a different thread. (0x8001010E (RPC_E_WRONG_THREAD))'
I have a on object that has:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
FontFamily="Segoe MDL2 Assets"
Foreground="{Binding ImageColor, Mode=OneWay}"
Text="{Binding ImageSrc, Mode=OneWay}" />
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
Text="{Binding VisitDescr, Mode=OneWay}" />
</Grid>
in the class I have
public string ImageSrc
{
get
{
switch (Type)
{
case "c1":
return "\xE8B9";
break;
default:
return "\xE8A5";
break;
}
}
}
public Brush ImageColor
{
get
{
switch (Type)
{
case "c1":
return new SolidColorBrush(Colors.MediumOrchid);
break;
case "c2":
return new SolidColorBrush(Colors.DarkOrchid);
default:
return new SolidColorBrush(Colors.Red);
break;
}
}
}
The image is returned without any error but the Color generate the error and is NOT changed.
How is it possible I get a marshalled error?
I've found the issue... it was using the work library. I've updated it to:
using System.Windows.Media;
and now is working. But why it got Marshalling and not type conversion error?
User contributions licensed under CC BY-SA 3.0