我有一個用戶控件,它有一個網格作爲根元素。 我想在我的控制下彈出一個呼叫框,以提供額外的信息。 我遇到的問題是呼出的高度和寬度與網格大小有關。 使控制非常小縮小呼叫框。 如何將標註尺寸設置爲文本內容的大小?Wpf表達式調出剪輯
這裏是該用戶控件
<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>
下面是結果
首先請刪除寬度=「162」爲ed:標註。 – Nitesh