2014-12-15 3 views
2

Я пытаюсь реализовать управление токеном (тегом) в WPF. Сам элемент управления работает, но мне нужна возможность обернуть PART_Editor из ComboBox за последним элементом списка. При переполнении элементы обертываются в новую строку.WPF ComboBox с PART_Editor как элемент Itemssource

Мой код выглядит следующим образом:

<ControlTemplate x:Key="EditTemplate"> 

     <!-- EditElementMinWidth ist die Mindestbreite des Eingabebereiches für weitere Tags --> 
     <WrapPanel> 
      <ListBox Style="{StaticResource WrapTagPanelListBoxStyle}" 
        ItemsSource="{Binding Path=TaggedItems,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" 
        SelectedItem="{Binding Path=SelectedItem,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" 
        ItemContainerStyle="{StaticResource WrapTagPanelItemContainerStyle}" 
        ItemTemplate="{StaticResource TagTemplate}" 
        ScrollViewer.HorizontalScrollBarVisibility="Disabled"> 
       <ListBox.ItemsPanel> 
        <ItemsPanelTemplate> 
         <WrapPanel IsItemsHost="True" Orientation="Horizontal" /> 
        </ItemsPanelTemplate> 
       </ListBox.ItemsPanel> 
      </ListBox> 

      <TextBox Name="PART_Editor" Style="{DynamicResource {themes:TextEditThemeKey ResourceKey=TextStyle}}" TextWrapping="Wrap" 
        GotFocus="UIElement_OnGotFocus" helpers:EditorMarginHelper.Margin="2,2,2,2,0,2,2,2" VerticalAlignment="Center" HorizontalAlignment="Stretch" /> 
     </WrapPanel> 
    </ControlTemplate> 

EditTemplate является Шаблон EditValue из DevExpress в ComboBox-Control.

Как я могу решить проблему?

ответ

0

Хорошо, я нашел рабочее решение. Я объединил ItemsSource ListBox с PART_Editor с помощью CompositeCollection.

EDIT:

+0

Вы можете оставить правильный код? У меня такая же проблема! –

+0

Я добавил его к своему последнему сообщению. – Sonic