0
我在使用設計器中的ExpressionTextBox控件時遇到輕微問題,這是我所擁有的活動。如何將其設置爲表達式類型 XAML中的屬性爲類型對象定義IEnumerable`1泛型?我可以逃避不設置它,但理想情況下,我想在設計時獲得驗證支持,以便控制此問題。將ExpressionTextBox的表達式類型設置爲一般類型
我試過以下,它不工作:
<View:ExpressionTextBox
VerticalContentAlignment="Center"
Expression="{Binding Path=ModelItem.SelectedDestinations, Converter={StaticResource ResourceKey=ArgumentToExpressionConverter}, ConverterParameter=Out}"
ExpressionType="{x:Type TypeName=Generic:IEnumerable[Communication:CommunicationDeliveryDestination]}"
OwnerActivity="{Binding Path=ModelItem}" />
在如何正確設置在XAML的ExpressionType屬性的任何想法?以下是我的活動設計師的完整XAML。
<sap:ActivityDesigner x:Class="UrbanScience.ELS.Orchestration.Activities.Design.SelectDestinationsByLeadDestinationTypeDesigner"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
xmlns:View="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
xmlns:sapc="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"
xmlns:Generic="clr-namespace:System.Collections.Generic;assembly=mscorlib"
xmlns:System="clr-namespace:System;assembly=mscorlib">
<sap:ActivityDesigner.Resources>
<ResourceDictionary>
<sapc:ArgumentToExpressionConverter x:Key="ArgumentToExpressionConverter" />
</ResourceDictionary>
</sap:ActivityDesigner.Resources>
<Grid Height="50">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="200" />
<ColumnDefinition MinWidth="200" />
</Grid.ColumnDefinitions>
<TextBlock Text="Lead Destination Type:" VerticalAlignment="Center" Grid.Row="0" Grid.Column="0" />
<ComboBox Name="LeadDestinationTypeItems" VerticalAlignment="Center" SelectedIndex="0" Grid.Row="0" Grid.Column="1" SelectionChanged="OnLeadDestinationTypeChanged" />
<TextBlock Text="Assign selected destinations to:" VerticalAlignment="Center" Grid.Row="1" Grid.Column="0" />
<View:ExpressionTextBox VerticalContentAlignment="Center"
Expression="{Binding Path=ModelItem.SelectedDestinations, Converter={StaticResource ResourceKey=ArgumentToExpressionConverter}, ConverterParameter=Out}"
ExpressionType="{x:Type TypeName=Generic:IEnumerable[Communication:CommunicationDeliveryDestination]}"
OwnerActivity="{Binding Path=ModelItem}" Grid.Row="1" Grid.Column="1">
</View:ExpressionTextBox>
</Grid>
</sap:ActivityDesigner>
對我來說,並不清楚_SelectedDestinations_意味着此處。你可以添加一個真實世界的例子。例如一個'公開論據 ActualValue {get;組; }',XAML中的實際綁定看起來像是「ExpressionType =」{Binding ModelItem.Properties [ActualValue] .PropertyType.GenericTypeArguments [0]}「'?謝謝。 –
Achim
2013-04-23 06:18:04