无论Xamarin WinPhone中的宽度设置如何,ComboBox始终是固定大小

时间:2016-10-06 14:24:16

标签: windows-phone-8.1 xamarin.winphone

我有以下模板:

    <DataTemplate x:Key="ListViewItemTemplate">
            <Grid x:Name="grid">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0"
                           Margin="5"
                           VerticalAlignment="Center"
                           FontSize="18"
                           Foreground="Black"
                           Text="{Binding Text}"
                           TextWrapping="WrapWholeWords" />
                <my:CustomControl Grid.Column="1"
                    ActualValue="{Binding Val, Mode=TwoWay}" />

                <ComboBox x:Name="cboxPicker"
                          Grid.Column="2"
                          Width="70"
                          MaxWidth="70"
                          MinWidth="70"
                          Margin="3"
                          HorizontalAlignment="Left"
                          VerticalAlignment="Center"
                          ItemsSource="{StaticResource dataSource}"
                          SelectedIndex="{Binding Val, Mode=TwoWay}" />
                 <Border Grid.Row="1"
                         Grid.ColumnSpan="3"
                         BorderBrush="Gray"
                         BorderThickness="1" />
   </Grid>
 </DataTemplate>

如果我添加了WidthMinWidthMaxWidth属性,它会将ComboBox切成两半。

enter image description here

如果我没有设置任何一个,那么ComboBox的宽度 大约在100-110 ,它太大了。

enter image description here

如何将其设置为合适且准确的尺寸?

0 个答案:

没有答案