WPFにToken(Tag)Controlを実装しようとしています。
コントロール自体は機能していますが、ComboBoxのPART_Editorをリストボックスの最後の項目の後ろにラップする可能性が必要です。オーバーフローすると、アイテムは新しい行に折り返されます。
私のコードは次のようになります:
<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は、DevExpress ComboBox-ControlのEditValueのテンプレートです。
どうすれば問題を解決できますか?
わかりました、実用的な解決策を見つけました。 CompositeCollectionを使用して、ListBoxのItemsSourceをPART_Editorとマージしました。
編集: