Home » WPFRSS

Binding Arguments to basic WPF controls

Hi

Binding an ExpressionTextbox to an argument is simple.

What happens when my custom activity designer contain other WPF controls like listbox, checkbox etc. How do I bind these simple controls to an argument expression. What converter should be used?

Manu

 

 

 

 

4 Answers Found

 

Answer 1

Your question is vague, but the answer is probably 'write your own converter'. It is actually very easy to write a value converter, please see the MSDN documentation for IValueConverter.

If this isn't what you need to know, please add some more details to your question.

Tim

 

Answer 2

Hi Again

Thanks for your reply.

My task is simple. I want to Create a custom  designer and use a combobox which is binded to an InArgument<T>

Creating a converter  is simple  for normal WPF application but for WF designer  there is a problem.

Converting an object of type T to Argument<T> is simple but the conversion back is problematic as we do not have the context object.

public class DateConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        //simple
       convert  the value to InArgument<targetType>

    }

  public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        //Problem
        How can I convery InArgument<T> to another object
        when to get value out of an Argument we need a NativeActivityContext
    }
}

By the way I tried to look at the convetors supplied by microsoft and I could not see the code in Reflector or ILDASM.exe .... Interesting...

manu

 

 

Answer 3

Dear Manu,

when you're dealing with a designer, the Argument VALUE is never known through the ActivityContext... simply because you don't have the ActivityContext...

This means, that, say you have an InArgument<string>. Each Argument variable, at design time, have a "Expression" property. You must assign an Expression (VisualBasicValue for instance), and never use an ActivityContext because this one is used at runtime by the activity  and not by the activity designer.

Hope it helps,

 

Answer 4

convetors supplied by microsoft and I could not see the code in Reflector or ILDASM.exe .... Interesting...

Are you loading the DLL from $(WinDir)\Microsoft.Net\? (If instead you are loading from Reference Assemblies, this is as expected, the ones in Reference Assemblies don't contain IL.)

Tim

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter