问题标签 [actualwidth]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
silverlight - Determining the size of a UIElement in Silverlight
I have a StackPanel containing a number of UIElements (which have been constructed using a template in from a XAML file) that I wish to display.
To display it in the correctly I need to know its size.
Initially Width/Height/ActualWidth/ActualHeight/DesiredSize
are all 0 or NaN. If I call panel.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)) then its ActualWidth/ActualHeight/DesiredSize are calculated (Width/Height remain as NaN). So far, so good.
However, the ActualWidth / DesiredSize.Width is set to the MinWidth value that was specified in the XAML template, even though, when drawn, the stackpanel is wider than this.
Why does the rendered size not match the ActualWidth/ActualHeight properties?
How can I determine what the rendered size will be so that I can position my panel correctly?
(the panel is for a pop-up tooltip that needs to appear near the mouse pointer, but its position needs adjusting if the tooltip would overflow its allowed area).
wpf - ActualWidth 作为 From WPF 动画的值
为什么我不能引用ActualWidth
一个值,我可以在代码中使用它。
XAML:
silverlight - 在运行时获取组合框弹出窗口的大小
我正在尝试获取 Silverlight ComboBox 下拉窗口的宽度和高度。不幸的是ActualWidth
,ActualHeight
总是返回 0。
wpf - 覆盖 ActualWidth 和 ActualHeight 依赖属性
我有一个带有起点和终点的自定义线条形状。然而,ActualWidth
andActualHeight
属性不会返回正确的值,即点之间的差异。有没有办法在派生类中覆盖这些属性,你将如何去做。我需要使用ActualWidth
andActualHeight
属性,因为我使用的算法将这些属性用于其他形状。
c# - 动态填充网格上的绑定问题 ActualWidth
考虑以下简单的代码:
XAML:
事件MouseDoubleClick
:
我的标签ActualWidth
通过绑定包含第二列的属性。在 Visual Studio 中,我看到我的标签包含值 316,因此绑定有效。
双击标签会触发其事件并在网格中添加一个额外的行,所有这些都具有随机长度。
我希望在我的标签上看到一个新值,但是(运行时计算的)0 不会改变!
我在这里想念什么?
silverlight - WriteableBitmap 在右侧添加黑色填充
我正在尝试使用Image
我的Canvas
(myPrintingCanvas
)之一。但是图像的宽度至少比画布宽两倍,并且创建的额外空间又回来了。如果我尝试另一个Canavas
( LayoutRoot
),它会按预期工作。
我的观察是,在myPrintingCanvas
ActualWidth 上始终为 0。LayoutRoot
有一个正确的ActualWidth
. 不确定它是否与额外的填充有关,并且我未能获得ActualWidth
for myPrintingCanvas
(使用UpdateLayout
and Measure
)。
代码:
wpf - 如何引用 MaxWidth="??" TextBlock 到所有者实际宽度?
如何引用stpMessage?MaxWidth="??"
_TextBlock
ActualWidth
c# - 实际高度/实际宽度
我对如何ActualWidth
或ActualHeight
如何工作或如何计算有点困惑。
当我使用上面的代码时,我得到 30ActualWidth
和ActualHeight
. 但是当我以编程方式定义椭圆时,ActualWidth
andActualHeight
为 0,即使我定义了 (max)height 和 (max)width 属性 - 我不明白它怎么可能是 0?
wpf - WPF转换器奇怪的行为
我将Width
a 的 a绑定TextBox
到ActualWidth
其包含的Grid
,如下所示:
如图,我使用的是Converter,如下:
奇怪的是,显示的代码工作正常。但是,如果我将return (d / 2)
语句替换为return (d - 75D)
,似乎会引发属性更改的无限循环。
这是 d / 2 的诊断跟踪标记的输出:
以下是 d - 75D 的诊断跟踪标记的输出:
关于什么解释了转换器的这种行为的任何想法?
c# - 如果我从代码创建文本块,如何计算加载时文本块的高度和宽度?
如果我从 Metro 中加载的事件中执行代码 - winRT 将为两者返回 0。
我怎样才能ActualWidth
参加Loaded
或SizeChanged
参加活动?