I am using the following arrays as parameters to my value converter. I can’t figure why “params2” is passed as an ArrayExtension and “params1” is passed as a simple TextBlock[] array.
<Window.Resources>
<x:Array Type="TextBlock" x:Key="params1">
<TextBlock Text="{x:Static local:Constants.MyDir}"></TextBlock>
<TextBlock>25</TextBlock>
</x:Array>
</Window.Resources>
<TabItem.Resources>
<x:Array Type="TextBlock" x:Key="params2">
<TextBlock Text="{x:Static local:Constants.MyDir}"></TextBlock>
<TextBlock>55</TextBlock>
</x:Array>
</TabItem.Resources>
Image Viewer XAML:
<Window x:Class="TotalViewer.ImageViewerWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:TotalViewer"
Title="ImageViewerWindow" Name="ImageViewerWindow1">
<Window.Resources>
<x:Array Type="TextBlock" x:Key="params1">
<TextBlock Text="{x:Static local:Constants.MyDir}"></TextBlock>
<TextBlock>25</TextBlock>
</x:Array>
</Window.Resources>
<Grid>
<Image Source="{Binding ElementName=ImageViewerWindow1, Path=ImagePath,
Converter={StaticResource ImageConverter},
ConverterParameter={StaticResource params1}}"/>
</Grid>
</Window>
Well, I kinda gave up for the moment because I need to get this part working. In the converter, I test if the parameter is either ArrayExtension or TextBlock[]. If it’s ArrayExtension, it will get converted to TextBlock[].