Hey,
I am building a set of Workflow Activities and a designer for the activity, one of which uses the XCeed CollectionControl to display a list of SQLParameters.
So, specifically, the WF Activity has a property which is a list of SQLParameters (List<SqlParameter>), which I would like to bind and be displayed in the CollectionControl. I'm still getting up to speed with WPF, so this might be somewhat obvious, but I've tried to bind it in different ways and can't.
Two problems:
//Convert from the activity properties to the designer element
ModelItem.Parameters is the property on the container WF Activity. Thanks!
I am building a set of Workflow Activities and a designer for the activity, one of which uses the XCeed CollectionControl to display a list of SQLParameters.
So, specifically, the WF Activity has a property which is a list of SQLParameters (List<SqlParameter>), which I would like to bind and be displayed in the CollectionControl. I'm still getting up to speed with WPF, so this might be somewhat obvious, but I've tried to bind it in different ways and can't.
Two problems:
- I don't understand which property to bind to on the Collection Control (I've tried both the Items on the control, as well as the ItemsSource, but neither seems to "connect")
-
I have a IValueConverter, but while I can get the Convert() method to be called, I can never get the ConvertBack of the converter to be called (which would put the list from the control back into the Property of the containing activity).
//Convert from the activity properties to the designer element
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
var modelItem = (ModelItem)value;
if (modelItem != null)
{
var inArgument = modelItem.GetCurrentValue() as InArgument<List<SqlParameter>>;
if (inArgument != null)
{
var expression = inArgument.Expression as Literal<List<SqlParameter>>;
if (expression != null)
{
var parameterList = expression.Value;
if (parameterList == null)
parameterList = new List<SqlParameter>();
return new ObservableCollection<SqlParameter>(parameterList);
}
}
}
return new ObservableCollection<SqlParameter>();
}
//Convert from the designer element to the activity property
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
var itemContent = (ObservableCollection<SqlParameter>)value;
var csArgument = new Literal<List<SqlParameter>>(itemContent.ToList());
var inArgument = new InArgument<List<SqlParameter>>(csArgument);
return inArgument;
}
And from the XAML: ModelItem.Parameters is the property on the container WF Activity. Thanks!