0
我已經創建了一個AutocompleteBox,它在ControlTemplate外完全正常工作。當我將它放在Control模板中時,自動完成框不再包含任何項目。ControlTemplate的設置Itemsource
<ControlTemplate x:Key="EditAppointmentTemplate" TargetType="telerik:SchedulerDialog">
<Grid Margin="6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="97" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Text="Participants" Margin="6 0" VerticalAlignment="Center" HorizontalAlignment="Left" />
<telerik:RadAutoCompleteBox Margin="6 0"
Grid.Column="1"
ItemsSource="{Binding Atts}"
SelectedItems="{Binding SelectedAttendees,Mode=TwoWay}"
DisplayMemberPath="DisplayName"
TextSearchPath="Search"
Style="{StaticResource MultiAutoBox}"
WatermarkContent="Search ..."
MinHeight="55" VerticalContentAlignment="Top" Padding="5">
</telerik:RadAutoCompleteBox>
</Grid>
</ControlTemplate>
<Style x:Key="EditAppointmentDialogStyle" TargetType="telerik:SchedulerDialog">
....
<Setter Property="Template" Value="{StaticResource EditAppointmentTemplate}" />
....
<Style x:Key="EditAppointmentDialogStyle"/>
<telerik:RadScheduleView x:Name="scheduleview" ....
EditAppointmentDialogStyle="{StaticResource EditAppointmentDialogStyle}"
....
<telerik:RadScheduleView x:Name="scheduleview"/>
我想我已經設置的ItemsSource爲目標相對祖先 我嘗試以下和的ItemSource不填充依然。
ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:SchedulerDialog}}, Path=Atts}"
您能否給我一個片段或PseudoCode,以便我能更深入地理解您所指的內容? – Master
@Master:你真的應該閱讀關於MSDN的控件創作,無論如何增加的例子... –