问题标签 [itemsource]

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

c# - 使用 Xamarin forms pcl - c # 实时更新列表视图中的项目

我的目标是实时更新记录列表视图。

在我设置的加载页面中:

每 10 秒(使用 API)他们将随机更新数据,只有几条记录。我的目标是在不刷新列表视图的情况下更新项目......并且不将 ItemSource 设置为 null 然后重新分配数据。

我尝试使用 for 循环滑动 ItemSource 并更新数据,但不起作用。

有可能吗?

0 投票
0 回答
34 浏览

c# - 参数化查询 OR 控制

我希望能够在 ASPX 页面上的 OR 子句中使用 QueryString 参数和控制参数。

以下适用于 QueryString 参数

下面不起作用

全称是控制参数(文本框、下拉列表等)(@Customer_Name、@Order_Number、@username、@Warehouse_Id)

字母是查询字符串(@C、@O、@W、@U)

如果未提供 QueryString 或 QueryString 包含值使用它,如何将 OR 子句添加到控件的默认值?

0 投票
1 回答
688 浏览

class - 如何从 Xamarin 表单中的另一个类更新列表视图?

我在一个类中创建了一个列表视图,并从另一个类中调用了 delete 方法。如果我从另一个班级打电话,Listview 接到电话但不更新列表视图。但是当我在同一个班级内打电话时它会得到更新。如何解决这个问题?

0 投票
1 回答
245 浏览

c# - uwp gridview 项目源甚至没有执行

如 BUILD 2017 中所述,我正在使用创作者秋季更新的新预览 sdk 16190。

我在 MVVM 模式下绑定了一个gridview,但它没有工作,所以我将它简化为直接代码后面以了解真正的问题,我什至使用了一个断点,看起来断点永远不会被命中那条线永远不会执行所以gridview 项目源保持为空。

我也试过 x:Bind 在 gridview 项目源上,它也不起作用。这真的很令人沮丧,因为它没有任何意义。下面是我的代码

XAML

0 投票
2 回答
1432 浏览

wpf - 创建自定义 DataGrid 的 ItemsSource - 不工作

我正在尝试从创建自定义 DataGrid 的 ItemsSource复制解决方案,但我的行没有填充。

列显示正确的标题,但网格中没有数据。

谁能告诉我我做错了什么?

和 XAML...

我得到的错误是

我觉得我很接近这个,但我只是错过了一件事。
可能数据上下文是错误的?

0 投票
1 回答
394 浏览

c# - 禁用 DatagridComboBox 中特定项目的选择

背景: 我有一个带有一些测量值的数据网格,我们可以批准和阻止这些测量值。现在我们有一个新的类型,比如“Cancelled”。但是只有服务器需要这种类型,并将其显示给客户。但是客户应该不能选择这个“已取消”,而是他应该选择的其他 2 种类型。

列表从数据库中获取所有不同的元素(3 个条目)。首先,我尝试从 ApprovementCollection 中删除已取消的项目,但随后它显示了一个空字段而不是“已取消”。

问题: 是否可以从 DataGridComboBoxColumn 的 Itemsource 属性的有界列表中仅禁用这 3 个项目之一?

在选择菜单中禁用或不显示是我必须做的。(仅限“Freigabe”和“GESPERRT”)

查看列表在行动

看法:

视图模型:

感谢您的帮助

0 投票
1 回答
124 浏览

c# - 如何使用 MVVM 更新 ContextMenu 的 ItemSource

我有一个 ContextMenu,我正在尝试从我的 ViewModel 类中绑定一个列表。我使用两种不同的方法设置了这个列表。OnZonesReceived进行更改时OnItemReceived触发方法,并在选定的选项卡项更改时触发方法。在这个项目中,我有 tabItems,每个 tabItem 都有自己的 DesignerCanvas。

The problem is Zonesis updated when selected tab Item changed but it is not updated when DesignerCanvas updated while OnZonesReceivedmethod is triggered and The input "canvas" has the correct ZonesList.

资源字典

视图模型

0 投票
1 回答
645 浏览

wpf - 如何将列表视图从视图模型绑定模型可观察集合更新到项目源

我有一个列表视图,其中还包含数据模板中的文本框,其中包含名称、地址、国家/地区等列。现在这个 listview 的 Itemsource 绑定到我的 viewmodel 类中模型的可观察集合。

ObservableCollection<Model>通过在 VM 中的某些条件下将名称和地址设为空来更新 ObjModel(类型),并且我可以在 viewmodel 类的 ObjModel 对象中看到名称的值,为空。但是这些更改并没有反映在 UI(ListView)中,我错过了什么,如何更新列表视图。

我的观点是这样的:

视图模型包含:

在某些情况下我会在某些地方

它不会在 ListView 中更新,因为它的 itemsource 绑定到 Model 对象 observable 集合,如何从这里更新 ListView?

我的模型是:

0 投票
1 回答
53 浏览

wpf - Listview itemsource 看不到 xaml 中的值

我的 listview itemsource 有这个问题,你看我在 WPF 中工作,问题出现在 VB 中(我认为),它就像被阻塞了,我添加的这个新列在 xaml 中看不到,列在那里但没有信息,如果我在指定 itemsource 列表的部分中放置一些断点,我可以看到这些值,并且当我这样做时会显示:

在此处输入图像描述

那把锁是我问题的主要原因,但我不知道如何将它从我的收藏列表中删除。请帮忙。 在此处输入图像描述

顺便说一句,我使用属性来创建一行,然后将其绑定到 xaml 在此处输入图像描述

0 投票
1 回答
482 浏览

c# - NavigationViewMenu not considering its MenuItemsSource

Sample : link

I'm developing an application that allows people to save notes, and create categories in which you can store your notes.

Categories are listed in a List, and an ObservableCollection, because I had a problem, trying to serialize a List of NavigationViewItems. So I made the following class:

And in my App.xaml.cs I have:

Categories (the ObservableCollection) is used as my NavigationView's MenuItemsSource :

In an other file, I have a function called OpenCategories, called at the opening of the application:

And here's UIServices.RefreshCategoriesUI() :

=> My issue is that even though App.Categories contains NavigationViewItems, my NavigationViewMenu is always empty. Why isn't it updating ?

Edit : Here are the changes I made.

Categories has been moved from App.xaml.cs to MainPage.xaml and has been transformed into a DependencyProperty

RefreshCategoriesUI is not used anymore. Instead, I turned CategoriesItems into a ObservableCollection property and subscribed to the CollectionChanged event:

And finally OpenCategories is now working this way:

Oh and it seems obvious but I changed the MenuItemSource of my NavigationView from App.Categories to Categories, as Categories moved.

It's still not working. And when I check during runtime, Categories contains all the categories I created through my app.

Moreover, it's really weird because when I first checked if Categories contained something (to write this post), after my breakpoint, all the categories popped up in the NavigationView as it's supposed to do everytime, but when I tried again it didn't work.