问题标签 [groupstyle]

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 回答
266 浏览

c# - 选择 ListView GroupStyle 项目

我在 UWP 中有一个带有GroupStyle的ListView ,就像这里的示例一样。我有以下HeaderTemplate

我可以通过

现在我的问题是,尽管知道所选的Key,但我无法从中访问Items。在调试中,我可以看到计数属性,它等于组内的元素数量,但我不知道如何迭代它。

我非常想遍历所有与 selKey 具有相同键的项目,为所有这些项目设置一个名为_isVisible的布尔属性。什么是实现这一目标的好/快速/有效的方法?

0 投票
0 回答
503 浏览

c# - 修改一项后更改Expander Header的前景色

大家好

我在修改扩展器的项目后更改扩展器标题的前景色时遇到问题。

这是我已经拥有的 WPF 代码段:

我已经尝试在更改值后刷新我的 ListCollectionView,但性能真的很差。

谢谢你的帮助...

更新: 这是我定义的 WPF 代码段GroupStyle

...以及此视图的 ViewModel:

0 投票
1 回答
163 浏览

c# - 使用 GroupStyle 过滤 ComboBox

我有一个 Telerik ComboBox,它应用了 GroupStyle。我想拥有它,以便在过滤项目时,如果没有子项目,组项目就会消失,并且它会继续沿层次结构向上。

所以,这是初始设置:

在此处输入图像描述

当前的:

在此处输入图像描述

期望:

在此处输入图像描述

以供参考:

GroupItem 样式

RadComboBox

0 投票
1 回答
1213 浏览

xaml - 如何通过在 Xamarin xaml {GroupStyle} 中添加样式来定义 ResourceDictionary

我正在尝试为网格内的所有标签设置属性

我知道怎么做,只是这样做:

但它丑陋且多余

我想做类似的事情

On App Static Resources 包括网格的 ResourceDictionary,例如:

我一直在尝试很多方法,但它总是抛出某种异常!

有人可以帮我吗?

0 投票
1 回答
69 浏览

c# - Binding in GroupStyle header not updated when collection changes

I have an ItemsControl which is bound to a CollectionViewSource bound to a property on the View Model.

The ItemsControl has a GroupStyle set which looks like this:

Where TotalDurationTemplate is:

The issue is that the second TextBlock (the one bound to Items) is not re-evaluated when a new item is added to the View Model's collection (which is an ObservableCollection<>). The item is added to the ListView into the correct group but the Total Duration value is not updated.

The Converter for Total Duration looks like this:

How do I make the binding refresh correctly when the items in the View Model are changed?

EDIT: The Solution

I took Solution 2 from the Accepted Answer and put it into my code. This is what ended up working:

And changing TotalDurationConverter to IMultiValueConverter. The just ignore the second item in the Array.

0 投票
1 回答
433 浏览

uwp - UWP - Stretch height of HeaderTemplate in ItemsStackPanel with GroupHeaderPlacement=Left

Inside an ItemsControl or ListView, is it possible to make the height of the GroupStyle.HeaderTemplate stretch to match the height of the grouped items?

Regardless of what I set VerticalAlignment/VerticalContentAlignment to, the group header appears to the left of the first item from the group.

0 投票
0 回答
620 浏览

c# - ItemsControl 和 GroupStyle 问题

下面的代码为集合中的每个项目生成一个 UserControl。数据显示正确,但由于某些我无法理解的原因,所有用户控件的大小都相同。

见图片

如您所见,Group2 包含多个 StackPanel。所有这些 StackPanel 都具有相同的尺寸,并且不会根据内容调整大小。

知道为什么吗?是因为ItemsPanelTemplate中定义的StackPanel吗?

0 投票
1 回答
188 浏览

wpf - ItemsControl 中的 GroupStyle HeaderTemplate 未正确更新

我正在为消息收件箱制作布局,目前正在根据天/周/月/年自动分离消息。更具体地说,对于当前日期收到的所有消息,我有一个标题为“今天”,昨天为“昨天”,3 到 6 天前的任何消息为“3 天前”。“上周”表示 7-13 天前的任何事情,举一些例子。你明白了。

到目前为止,所有这些都很好,除了一件事。如果我一夜之间离开应用程序,我今天的消息将被标记为“今天”,但所有旧标题都不会改变。所以昨天也被标记为“今天”,2天前是“昨天”等等。它们仍然按应有的方式分组,只是标题不会更新。感觉它缺少某种 OnPropertyChanged 功能,但它在当前状态下如何工作?

我的 GroupStyle 是如何设置的:

我的转换器(从 DateTime 更改为要呈现的字符串)

还可以补充一点,如果我重新启动应用程序,它仍然可以工作,但是我不能让它在一夜之间不出现故障,这太烦人了,不容忽视。

如果需要,请从我的旧问题中获得更多背景信息

0 投票
1 回答
38 浏览

wpf - 如何将多个 DataSet 列值绑定到 GroupStyle TextBlock

我有以下数据集,其中“部分”数据表列绑定为 PropertyGroupDescription。我还想绑定“DESCRIPTION”列,但不将其绑定到 PropertyGroupDescription,因为这会影响分组。

我现在得到的:

我想得到什么:

因为具有相同部件号的所有行共享相同的描述。

当前代码:

CS:

XAML:

0 投票
1 回答
77 浏览

c# - 有没有办法做 ListViewHeaderItem 到底做什么?

我想实现一个自定义视图,就像ListView.

现在的问题是我想从组头中获取一个 Tapped 事件,也许更多。
它总是将 GroupItem创建为组视图,并且不能更改。

我发现 ListView 所做的是由系统创建ListViewHeaderItem并在实现GroupStyle.HeaderTemplate. 我的问题是有什么方法可以做到这一点?

CS:

xml:

CustomView 可视化树:

ListView 可视化树: