问题标签 [uwp-xaml]

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 投票
7 回答
21352 浏览

xaml - Wrap TextBlock 的最大行数

我有TextBlock以下设置:

我可以确定最大行数吗?

例如考虑以下字符串TextBlock.Text

目前有这样的节目:

我需要它变成这样的东西:

任何解决方案?

0 投票
5 回答
44155 浏览

wpf - How to make scrollviewer work with Height set to Auto in WPF?

I have learned that if the height of a grid row, where the ScrollViewer resides, is set as Auto, the vertical scroll bar will not take effect since the actual size of the ScrollViewer can be larger than the height in sight. So in order to make the scroll bar work, I should set the height to either a fixed number or star height

However, I now have this requirement, that I have two different views reside in two grid rows, and I have a toggle button to switch between these two views: when one view is shown, the other one is hidden/disappeared. So I have defined two rows, both heights are set as Auto. And I bind the visibility of the view in each row to a boolean property from my ViewModel (one is converted from True to Visible and the other from True to Collapsed. The idea is when one view's visibility is Collapsed, the height of the grid row/view will be changed to 0 automatically.

The view show/hidden is working fine. However, in one view I have a ScrollViewer, which as I mentioned doesn't work when the row height is set as Auto. Can anybody tell me how I can fulfill such requirement while still having the ScrollViewer working automatically`? I guess I can set the height in code-behind. But since I am using MVVM, it would require extra communication/notification. Is there a more straightforward way to do that?

0 投票
2 回答
2682 浏览

windows-8 - 操作模式解释

有人可以解释操作模式的含义,例如TranslateX, TranslateRailsX,TranslateInertia吗?什么是rail mode? 他们在谈论什么惯性?

0 投票
1 回答
1111 浏览

xaml - 如何更改 Windows 应用程序中的 RelativePanel 附加属性?

我试图在 Visual State 的 VisualState.Setters 中通过 XAML 更改控件的 RelativePanel 附加属性,但属性没有改变,所以我创建了一个依赖属性来通过后面的代码进行测试,也没有。

有什么方法可以刷新到一组新的值,例如:

并使视图更具“响应性”?

0 投票
2 回答
10275 浏览

xaml - 何时在 UserControl 上使用模板化控件?

我正在寻找一些关于如何在 WinRT 中创建自定义控件的教程,我有一个问题。

假设我想创建一个简单的控件,其中包含一些东西,比如左边有一个图像的网格,右边有几个 TextBlock。

我的意思是,一些简单的事情,例如:

我将使用此内容创建一个 UserControl,因此在我处理其 UI 时,我将能够在 XAML 设计器中看到它,并且我将在后面的 UserControl 代码中添加所有 Properties 和 DependencyProperties。

然后我看到另一种方法是使用模板控件,所以我必须创建一个继承自 Control 类的类,然后使用上面的 XAML 代码作为模板并将其应用于自定义控件并添加所有其余的逻辑在那里。

当然,我还必须将 x:Name 属性添加到控件内的一些 UIElement 中,以便能够与它们进行交互,但你明白了。

我想知道,可以使用这两种方法中的一种,还是特别使用一种更好,为什么?另外,我喜欢使用 UserControls,因为我可以在设计器窗口中看到它们,而我无法使用模板来执行此操作,我必须运行应用程序并创建控件的实例以查看它的内容其实看起来。

感谢您的帮助,我想我不是唯一一个有这个疑问的人,所以我希望这个问题也能帮助其他人:D

塞尔吉奥

0 投票
1 回答
1121 浏览

c# - SplitView.PaneClosed 事件可用,但不适用于 PaneOpened

根据https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.splitview.paneclosed.aspx,SplitView控件没有 PaneOpened 事件,只有 PaneClosed 事件存在的 SplitView 控件。

我在 SplitView 窗格中有一个 Button 控件,该控件需要根据窗格是打开还是关闭来更改大小。所以我的计划是我将放置一段代码,在 PaneOpened 事件中将按钮大小更改为更宽,并在 PaneClosed 事件中将其恢复为小尺寸。但似乎没有 PaneOpened 事件。

我可以通过其他任何方式实现这一目标吗?

0 投票
2 回答
19201 浏览

xaml - UWP 项目中不支持触发元素 (XAML)

我正在为 Windows 10 开发通用 Windows 应用程序,我发现的第一件事是设置图像样式时不支持触发元素 (XAML)。这是我要实现的代码:

在此处输入图像描述

抱歉,我不得不在这里使用图像,我是从我的 VM 中获取的。

这种类型的触发器现在如何在通用 Windows 应用程序中实现?

0 投票
1 回答
1320 浏览

xaml - 水平/垂直对齐在RelativePanel中不起作用

我正在尝试创建一个RelativePanel(用于回流目的),其中包含两个Image和一个StackPanel。在“小屏幕”视图中,我希望它垂直排列在一列中:Image, StackPanel, Image. 它这样做很好,但问题是StackPanel高度为 0,所以底部Image会撞到它。我想要Image捕捉到屏幕底部。然而,VerticalAlignment="Bottom"拒绝工作。经过多一点测试,我发现这HorizontalAlignment也不起作用。对齐在 a 中是否无法正常工作RelativePanel?或者有什么特殊的方法可以做到吗?

这是完整的 XAML:

0 投票
4 回答
4630 浏览

c# - 从 UWP XAML 中的 HyperlinkBut​​ton 中删除下划线


我需要删除内容中的下划线HyperLinkButtonTextDecorations此 XAML 元素中不存在。

0 投票
1 回答
599 浏览

xaml - VisualState commonState 不起作用 xaml

我有这个 XAML 视图。VisualStateGroups视觉触发器的 工作正常,但常见VisualStateGroup状态的 不能。

我尝试在开始时分配给一个矩形,然后都不起作用。在其他视图中,这很好用.. :(