Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wpf表达式调出剪裁_Wpf_Expression Blend - Fatal编程技术网

Wpf表达式调出剪裁

Wpf表达式调出剪裁,wpf,expression-blend,Wpf,Expression Blend,我有一个用户控件,它有一个网格作为根元素。 我想在我的控制下弹出一个呼叫框,提供额外的信息。 我的问题是调用的高度和宽度与网格大小有关。 使控件非常小会缩小调用框。 如何使详图索引的大小与文本内容的大小一致 这是用户控件 <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xm

我有一个用户控件,它有一个网格作为根元素。 我想在我的控制下弹出一个呼叫框,提供额外的信息。 我的问题是调用的高度和宽度与网格大小有关。 使控件非常小会缩小调用框。 如何使详图索引的大小与文本内容的大小一致

这是用户控件

<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing" 
mc:Ignorable="d"
x:Class="WpfUserControlsTest.Door"
x:Name="UserControl"
d:DesignWidth="86" d:DesignHeight="19">

<Grid x:Name="LayoutRoot">
    <Rectangle  Fill="Red"/>
    <ed:Callout AnchorPoint="-0.012,1.349" CalloutStyle="RoundedRectangle" Content="Callout text in here" Fill="#FFF4F4F5" FontSize="14.667" HorizontalAlignment="Left" Height="53" Margin="91,-72,-167,0" Stroke="Black" VerticalAlignment="Top" Width="162"/>
</Grid>

在这里使用

<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WpfUserControlsTest" x:Class="WpfUserControlsTest.MainWindow"
    Title="MainWindow" Height="350" Width="525">
<Grid>
    <Canvas>
        <local:Door HorizontalAlignment="Left" Height="9" VerticalAlignment="Top" Width="23.333" Canvas.Left="28.666" Canvas.Top="83.333" />
    </Canvas>
</Grid>

结果如下

在WPF中,设置显式
高度和/或
宽度和/或
尺寸和/或
边距将阻止
用户控件调整自身大小。如果希望
UserControl
将其自身大小重新调整为其内容的大小,只需删除已设置的显式布局和尺寸值。

首先请删除ed:Callout的Width=“162”。感谢您的查看,但这不是我想要的。如果我这样做了,召唤箱将没有大小或位置。只有当它没有内容和位置与大小无关时,它才会没有大小。。。设置位置不会影响大小。尽管如此,随你的便。:)