我有以下AutoCompleteBox:
<Controls:AutoCompleteBox x:Name="txtComponent" VerticalAlignment="Center" Height="25" FontFamily="Segoe UI" MinimumPrefixLength="2"
TextSearch.TextPath="Value" SelectedItem="{Binding Path=Selected, Mode=TwoWay}" IsTextCompletionEnabled="True"
FontSize="13.333" Grid.Row="0" Grid.Column="1" DropDownClosing="txtComponent_DropDownClosing">
<Controls:AutoCompleteBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=SiteName}"/>
</DataTemplate>
</Controls:AutoCompleteBox.ItemTemplate>
</Controls:AutoCompleteBox>
问题在于建议下拉列表已超出界限。
如何设置DropDown列表的最大宽度?
答案 0 :(得分:0)
试试这个:
<TextBlock Text="{Binding Path=SiteName}" Width="{Binding ElementName=txtComponent, Path=ActualWidth}"/>
它应该遍历树并将下拉宽度绑定到父宽度。