0

我尝试创建一些正确的 XAML以将文本排列在ComboBox右侧,但我不能。

这是我的 XAMl ......任何线索我错过了什么?谢谢!

 <ComboBox Height="25"
           HorizontalAlignment="Left" 
           ItemsSource="{Binding NonArchivedSequences}"  
           SelectedItem="{Binding SelectedSequence}"
           Margin="0,0,0,4" 
           Name="cbSequences" 
           VerticalAlignment="Top" 
           Width="504"                   
           HorizontalContentAlignment="Stretch" 
           SelectionChanged="cbSequences_SelectionChanged"
           Grid.Column="1">
            <ComboBox.Resources>
                <DataTemplate x:Key="DataTemplateSequenceData">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Margin="4,2,2,4"
                                   TextWrapping="Wrap"
                                   Text="{Binding Interval}" 
                                   d:LayoutOverrides="Width, Height"
                                   VerticalAlignment="Center" 
                                   HorizontalAlignment="Left" />
                        <TextBlock Margin="4,2,2,4"
                                   TextWrapping="Wrap"
                                   Text="{Binding Name}" 
                                   d:LayoutOverrides="Width, Height" Grid.Column="1"
                                   VerticalAlignment="Center"
                                   HorizontalAlignment="Left" />
                    </Grid>
                </DataTemplate>
            </ComboBox.Resources>
            <ComboBox.ItemTemplate>
                <StaticResource ResourceKey="DataTemplateSequenceData"/>
            </ComboBox.ItemTemplate>
        </ComboBox>

在此处输入图像描述

4

1 回答 1

1

也许 Horizo​​nalAllalignment="Right" 你已经离开了

于 2012-04-04T12:57:56.023 回答