Skip to main content
Replace with Collection based class to avoid editor problems.
Source Link

If your input will not work with a string, and you have multiple parameters (not bindings). You can just pass an arraycollection. Define one of whatever type is needed to avoid some UI Editor issues with arrays:

public class BrushCollection : Collection<Brush>
{
}

Then add the XAML using the collection

                <TextBox.Background >
                    <Binding Path="HasInitiativeChanged" Converter="{StaticResource changedToBrushConverter}">
                        <Binding.ConverterParameter>
                            <x<local:Array Type="Brush">BrushCollection>
                                <SolidColorBrush Color="{DynamicResource ThemeTextBackground}"/>
                                <SolidColorBrush Color="{DynamicResource SecondaryColorBMedium}"/>
                            </xlocal:Array>BrushCollection>
                        </Binding.ConverterParameter>
                    </Binding>

                </TextBox.Background>

And then cast the result to an array of the appropriate type in the converter:

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {

        Brush[]BrushCollection brushes = (Brush[]BrushCollection)parameter;

The only problem is that the VisualStudio UI might not understand this. I've had problems with the code working but the editor failing, so keep that in mind.

If your input will not work with a string, and you have multiple parameters (not bindings). You can just pass an array:

                <TextBox.Background >
                    <Binding Path="HasInitiativeChanged" Converter="{StaticResource changedToBrushConverter}">
                        <Binding.ConverterParameter>
                            <x:Array Type="Brush">
                                <SolidColorBrush Color="{DynamicResource ThemeTextBackground}"/>
                                <SolidColorBrush Color="{DynamicResource SecondaryColorBMedium}"/>
                            </x:Array>
                        </Binding.ConverterParameter>
                    </Binding>

                </TextBox.Background>

And then cast the result to an array of the appropriate type in the converter:

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {

        Brush[] brushes = (Brush[])parameter;

The only problem is that the VisualStudio UI might not understand this. I've had problems with the code working but the editor failing, so keep that in mind.

If your input will not work with a string, and you have multiple parameters (not bindings). You can just pass an collection. Define one of whatever type is needed to avoid some UI Editor issues with arrays:

public class BrushCollection : Collection<Brush>
{
}

Then add the XAML using the collection

                <TextBox.Background >
                    <Binding Path="HasInitiativeChanged" Converter="{StaticResource changedToBrushConverter}">
                        <Binding.ConverterParameter>
                            <local:BrushCollection>
                                <SolidColorBrush Color="{DynamicResource ThemeTextBackground}"/>
                                <SolidColorBrush Color="{DynamicResource SecondaryColorBMedium}"/>
                            </local:BrushCollection>
                        </Binding.ConverterParameter>
                    </Binding>

                </TextBox.Background>

And then cast the result to an array of the appropriate type in the converter:

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {

        BrushCollection brushes = (BrushCollection)parameter;
Note about UI failure.
Source Link

If your input will not work with a string, and you have multiple parameters (not bindings). You can just pass an array:

                <TextBox.Background >
                    <Binding Path="HasInitiativeChanged" Converter="{StaticResource changedToBrushConverter}">
                        <Binding.ConverterParameter>
                            <x:Array Type="Brush">
                                <SolidColorBrush Color="{DynamicResource ThemeTextBackground}"/>
                                <SolidColorBrush Color="{DynamicResource SecondaryColorBMedium}"/>
                            </x:Array>
                        </Binding.ConverterParameter>
                    </Binding>

                </TextBox.Background>

And then cast the result to an array of the appropriate type in the converter:

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {

        Brush[] brushes = (Brush[])parameter;

The only problem is that the VisualStudio UI might not understand this. I've had problems with the code working but the editor failing, so keep that in mind.

If your input will not work with a string, and you have multiple parameters (not bindings). You can just pass an array:

                <TextBox.Background >
                    <Binding Path="HasInitiativeChanged" Converter="{StaticResource changedToBrushConverter}">
                        <Binding.ConverterParameter>
                            <x:Array Type="Brush">
                                <SolidColorBrush Color="{DynamicResource ThemeTextBackground}"/>
                                <SolidColorBrush Color="{DynamicResource SecondaryColorBMedium}"/>
                            </x:Array>
                        </Binding.ConverterParameter>
                    </Binding>

                </TextBox.Background>

And then cast the result to an array of the appropriate type in the converter:

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {

        Brush[] brushes = (Brush[])parameter;

If your input will not work with a string, and you have multiple parameters (not bindings). You can just pass an array:

                <TextBox.Background >
                    <Binding Path="HasInitiativeChanged" Converter="{StaticResource changedToBrushConverter}">
                        <Binding.ConverterParameter>
                            <x:Array Type="Brush">
                                <SolidColorBrush Color="{DynamicResource ThemeTextBackground}"/>
                                <SolidColorBrush Color="{DynamicResource SecondaryColorBMedium}"/>
                            </x:Array>
                        </Binding.ConverterParameter>
                    </Binding>

                </TextBox.Background>

And then cast the result to an array of the appropriate type in the converter:

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {

        Brush[] brushes = (Brush[])parameter;

The only problem is that the VisualStudio UI might not understand this. I've had problems with the code working but the editor failing, so keep that in mind.

Source Link

If your input will not work with a string, and you have multiple parameters (not bindings). You can just pass an array:

                <TextBox.Background >
                    <Binding Path="HasInitiativeChanged" Converter="{StaticResource changedToBrushConverter}">
                        <Binding.ConverterParameter>
                            <x:Array Type="Brush">
                                <SolidColorBrush Color="{DynamicResource ThemeTextBackground}"/>
                                <SolidColorBrush Color="{DynamicResource SecondaryColorBMedium}"/>
                            </x:Array>
                        </Binding.ConverterParameter>
                    </Binding>

                </TextBox.Background>

And then cast the result to an array of the appropriate type in the converter:

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {

        Brush[] brushes = (Brush[])parameter;