【发布时间】:2017-11-27 21:22:53
【问题描述】:
我有一个使用自定义 ComboBox 的 Windows 应用程序。在我的机器文本中正确显示。但在其他机器中,它会切断一点。请问有什么建议吗?
<ComboBox Width="140" Height="5"
ItemsSource="{Binding SecurityContexts, Mode=OneWay}"
SelectedItem="{Binding ActiveSecurityContext, Mode=TwoWay}"
ToolTip="Working Location">
<ComboBox.ItemTemplate>
<DataTemplate>
<!--<TextBlock Text="{Binding Location}"/>-->
<TextBlock Height="27">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0}
{1}">
<Binding Path="AddBlank" FallbackValue=''/> <!--Just to add a blank field to hide the location details-->
<Binding Path="Location" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
【问题讨论】:
-
高度=“5”?试着让它足够大。不同的机器会有不同的字体设置,不同版本的 Windows 会有不同的默认控制模板。允许正常变化。如果用户沉迷于荒谬的变化,那不是你的问题。