调整边框大小的问题

本文关键字:问题 边框 调整 | 更新日期: 2023-09-27 18:09:18

边框内有用户控件(按钮)。当鼠标离开时,边框会慢慢缩小,然后按下按钮。然后按字母顺序丢失按钮内容。

例如

:一般情况,一般情况,一般情况,General Informa, General Inform, General Infor,General Info, General Inf, General In,一级将军、一级将军等等……但是我想显示如下内容

一般信息然后失去了。

<UserControl x:Class="HID_okworkbench.readerButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:HID_okworkbench="clr-namespace:HID_okworkbench"
x:Name="readerButtonControl" FontFamily="Tahoma" FontSize="11"
Height="auto" Width="auto">
<Grid>
    <Button Name="omniButton" Height="75" VerticalAlignment="Center"  
                                Style="{DynamicResource MyBottomLeftButtonStyle}" 
                                Background="White" 
                                HorizontalContentAlignment="Left" BorderThickness="0">
        <DockPanel Name="dockPanelOmni" Margin="0,0,0,0">
            <Image Name="omniButtonImage" DockPanel.Dock="Left"  Height="35" Width="35" 
                                       Stretch="Uniform" />
            <Label Name="omniButtonLabel" DockPanel.Dock="Right" Foreground="DarkBlue" VerticalAlignment="Center">
            </Label>
        </DockPanel>
    </Button>
</Grid>

调整边框大小的问题

不知道你在说什么,但尝试添加Width="Auto"到所有东西,包括将托管你的readerButtonControl实例的控件。

如果这没有帮助,添加一些屏幕截图和xaml包含您的readerButtonControl的实例