问题标签 [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.

0 投票
1 回答
1104 浏览

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).

0 投票
1 回答
7108 浏览

wpf - ActualWidth 作为 From WPF 动画的值

为什么我不能引用ActualWidth一个值,我可以在代码中使用它。

XAML:

0 投票
3 回答
739 浏览

silverlight - 在运行时获取组合框弹出窗口的大小

我正在尝试获取 Silverlight ComboBox 下拉窗口的宽度和高度。不幸的是ActualWidthActualHeight总是返回 0。

0 投票
1 回答
543 浏览

wpf - 覆盖 ActualWidth 和 ActualHeight 依赖属性

我有一个带有起点和终点的自定义线条形状。然而,ActualWidthandActualHeight属性不会返回正确的值,即点之间的差异。有没有办法在派生类中覆盖这些属性,你将如何去做。我需要使用ActualWidthandActualHeight属性,因为我使用的算法将这些属性用于其他形状。

0 投票
1 回答
4671 浏览

c# - 动态填充网格上的绑定问题 ActualWidth

考虑以下简单的代码:


XAML:

事件MouseDoubleClick


我的标签ActualWidth通过绑定包含第二列的属性。在 Visual Studio 中,我看到我的标签包含值 316,因此绑定有效。

双击标签会触发其事件并在网格中添加一个额外的行,所有这些都具有随机长度。

我希望在我的标签上看到一个新值,但是(运行时计算的)0 不会改变!

我在这里想念什么?

0 投票
1 回答
240 浏览

silverlight - WriteableBitmap 在右侧添加黑色填充

我正在尝试使用Image我的CanvasmyPrintingCanvas)之一。但是图像的宽度至少比画布宽两倍,并且创建的额外空间又回来了。如果我尝试另一个Canavas( LayoutRoot),它会按预期工作。

我的观察是,在myPrintingCanvasActualWidth 上始终为 0。LayoutRoot有一个正确的ActualWidth. 不确定它是否与额外的填充有关,并且我未能获得ActualWidthfor myPrintingCanvas(使用UpdateLayoutand Measure)。

代码:

0 投票
1 回答
3008 浏览

wpf - 如何引用 MaxWidth="??" TextBlock 到所有者实际宽度?

如何引用stpMessageMaxWidth="??"_TextBlock ActualWidth

0 投票
1 回答
1635 浏览

c# - 实际高度/实际宽度

我对如何ActualWidthActualHeight如何工作或如何计算有点困惑。

当我使用上面的代码时,我得到 30ActualWidthActualHeight. 但是当我以编程方式定义椭圆时,ActualWidthandActualHeight为 0,即使我定义了 (max)height 和 (max)width 属性 - 我不明白它怎么可能是 0?

0 投票
2 回答
392 浏览

wpf - WPF转换器奇怪的行为

我将Widtha 的 a绑定TextBoxActualWidth其包含的Grid,如下所示:

如图,我使用的是Converter,如下:

奇怪的是,显示的代码工作正常。但是,如果我将return (d / 2)语句替换为return (d - 75D),似乎会引发属性更改的无限循环。

这是 d / 2 的诊断跟踪标记的输出:

以下是 d - 75D 的诊断跟踪标记的输出:

关于什么解释了转换器的这种行为的任何想法?

0 投票
3 回答
5055 浏览

c# - 如果我从代码创建文本块,如何计算加载时文本块的高度和宽度?

如果我从 Metro 中加载的事件中执行代码 - winRT 将为两者返回 0。

我怎样才能ActualWidth参加LoadedSizeChanged参加活动?