问题标签 [celltemplate]
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.
c# - 如何解决通用 GridView 中的通用 ComboBox 表示
我在用户控件 (DataGridView) 中有一个 DataGrid。此用户控件从应用程序的任何位置传播到 DataGrid 的 ItemsSource 的绑定,并用 K 的列表填充它。
对于此示例,让我们为 K 定义具有一些具有自定义属性的属性的类:
DataGrid 有一个用于自动生成列的事件。
“enumTemplate”的资源在 MergedDictionary 中定义为 DataTemplate
我打算做的是设置网格将生成的每个 ComboBox 的 ItemsSource,其返回值为字符串 [] 类型的 Enum.GetNames(enumAttribute.EnumerationType)。
现在这里有很多匿名性,我不知道属性的名称、它们的类型,甚至这个 DataGrid 在运行时将显示的对象的类型。
我对此进行了几次尝试......比如定义一个 List> 类型的属性 DataSourcesList,其中 NamedArray 包含要填充组合框的项目和属性的名称(来自 e.PropertyName),以便我知道哪个 NamedArray 用于组合框正在生成...类似于:
然后更改 DataTemplate:
,但由于 ConverterParameter 不是 DependencyObject 且无法绑定,因此无法执行此操作。
也许我应该声明,以后应该将相同的原则用于绑定集合而不仅仅是枚举。
所以拜托,任何人都可以帮助我解决通用 GridView 中的通用 ComboBox 表示。
Tnx 和快乐的编码。
wpf - 将整个选定的 DataGrid 行模板设置为 CellEditingTemplate
我有一个关于 WPF DataGrid 的问题。为了 IDataErrorInfo 验证,我想将整个选定的行设置为编辑 - 我的意思是将每个单元格(在该行中)的数据模板从 CellTemplate 设置为 CellEditingTemplate。
例如,这是一列:
这在 XAML 中是否可行(某种触发器)?我将如何在代码隐藏中做到这一点?我找到了具有两种不同样式作为资源的解决方案,然后在 Row_Selected 和 Row_Unselected 事件中以编程方式在它们之间切换,但我宁愿将现有的上述 XAML 代码用于列(具有单独的 CellTemplate 和 CellEditingTemplate)。
谁能指出我正确的方法?
提前致谢。最好的问候, DB
wpf - 我们如何允许用户以不同的方式从 WPF gridview 控件添加/编辑/删除记录?
在 WPF xaml 页面中,我想为用户提供一个组合框,其中将有两个选项:
(1) 允许用户在 gridview 中编辑 (2) 允许用户在表单中编辑
如果用户选择第一个选项,那么我希望用户允许在 gridview 本身中添加/编辑记录。
如果用户选择第二个选项,则在单击 gridview 的添加/编辑按钮时,将出现一个表单页面,其中包含 gridview 的所有字段。在表单中,用户将能够添加/编辑 gridview 的记录。
任何人都可以对此提出想法吗?
这是DataGrid的主要代码。
wpf - GridViewColumn CellTemplate 中每个 DataType 的 DataTemplate
我有一个包含多种类型的视图模型的 ObservableCollection,我想为每个 GridViewColumn 的 CellTemplates 中的每种类型创建一个 DataTemplate。在这个简单的示例中,我可以创建一个基本 ViewModel,但我希望能够仅从 xaml 执行此操作。下面的 xaml 显示了我正在尝试做的事情,其中一个 DataTemplate 将用于每个 CellTemplate。
如果有一个 GridViewColumn.Resources 我会在那里定义 DataTemplates 然后在 CellTemplate 中使用带有 ContentPresenter 的 DataTemplate,但我显然不能这样做。我想我可能需要一个 TemplateSelector,但我不确定从哪里开始。
wpf - 获取 DataGridTemplate 列中所有选定复选框的 WPF Datagrid Row
我有一个DataGrid
显示几个名册信息的Employees
. 我添加了一个带有CheckBox
. 我想从选定(选定)行KeyIDs
的所有行中获取(从数据库绑定)。CheckBox
这些KeyIDs
我必须传递给 SQL 以删除选定的行 ( BtnDeleteSelected_Click
)。请帮忙。
这是我的DataGrid
:
c# - WPF DataGrid with different UserControl in each Cell
I hava a data model which looks like this:
Now I want to display these models in a Datagrid which shall look like this:
How could I achieve this? Please provide some example code. I tried the whole day with different kind of DataTemplateSelectors but I just can't get it working
angularjs - 使用 CellTemplate 和 Directive 在 ng-grid 中的单元格中的 jQuery Sparkline
我正在尝试在 ng-grid 的一个单元格中的每一行中引入 jQuery Sparkline。该列包含数值数组数据。
Plunkr --> http://plnkr.co/edit/1eNEcx6FQWcJynlVYvFw?p=preview
我正在使用带有单元格模板的指令来实现这一点。
单元格模板:
指示:
我很难在链接函数中获取 attrs.ngAgeData 值。我不确定我错过了什么。请帮忙!!!
谢谢
c# - Reusing data template for multiple types?
I have the following DataTemplate
for displaying the full name of a User
instance:
I currently use it to customize a template column, like so:
This column belongs to a data grid full of User
instances, but I would like to re-use the data template for a column in a different data grid. This second data grid binds to a different type, which instead keeps User
as a property, so I'd like to do this:
However, the Binding
attribute isn't permitted for a template column.
How can I specify a binding path for the column template, or modify the data template, such that the data template can be reused for either data grid?
wpf - DataTemplate 目标父元素中的 Setter(从 CellTemplate 影响 DataGridRow)
我需要根据单元格的 DataContext 值折叠当前的 DataGridRow ,
任何想法如何做到这一点?
只是为了澄清我不希望有一个 Setter,其中 Target 位于 DataGridRow 类型的 RelativeSource 中。
目前我应用此更改:
我想知道是否有不同的方式,当然只使用 xaml,因为我可以遍历可视化树并在代码中执行此操作。
wpf - 列表视图单元格内的文本框
我有一个列表视图,我想在每个 gridview 列单元格中添加一个文本框,以便我可以在其中输入数据,然后获取该数据。
我正在创建一个数据模板并将其传递给 GridViewColumn 的单元格模板,但是当我查看列表视图时,我无法向单元格添加任何内容。看起来甚至没有创建文本框。