datagridtemplatecolumn

Silverlight, datagrid, autogenerated columns on modified column change cell visibility of content

試著忘記壹切 提交于 2020-01-05 04:09:12
问题 I have a form, it has a grid. I autogenerate the columns and tweak them as required: if (e.PropertyName == "id") { System.Windows.Style style = new Style(typeof(DataGridCell)); style.Setters.Add(new Setter(DataGridCell.ContentTemplateProperty, CreateBtnTemplate(30))); e.Column.CellStyle = style; } private static DataTemplate CreateBtnTemplate(int width) { string str = "<DataTemplate xmlns='http://schemas.microsoft.com/client/2007' >" //+ "<Button Tag='{Binding id}' Content='Respond' + "

Create Common DataGridTemplateColumn in WPF

时光总嘲笑我的痴心妄想 提交于 2020-01-01 10:58:11
问题 I need to create a common DataGridTemplateColumn , so that I can use it across my application with different objects and properties. here is some sample code, I use in my project <DataGridTemplateColumn Width="100*"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding Path=Age}"/> </DataTemplate> </DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellEditingTemplate> <DataTemplate> <TextBox Text="{Binding Path=Age}"/> </DataTemplate> <

Create Common DataGridTemplateColumn in WPF

纵然是瞬间 提交于 2020-01-01 10:58:04
问题 I need to create a common DataGridTemplateColumn , so that I can use it across my application with different objects and properties. here is some sample code, I use in my project <DataGridTemplateColumn Width="100*"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding Path=Age}"/> </DataTemplate> </DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellEditingTemplate> <DataTemplate> <TextBox Text="{Binding Path=Age}"/> </DataTemplate> <

Custom DataGrid column with a CellTemplate and binding

北慕城南 提交于 2019-12-30 07:04:10
问题 I need to create a reusable DataGrid column with a custom CellTemplate. This CellTemplate should, among other things, contain a TextBlock control to which I need to bind values to display in the DataGrid. All examples I've seen so far specified the CellTemplate for a column directly when using it in a DataGrid's Columns property and also specified a Binding directly to the TextBlock, e.g.: <data:DataGrid> <data:DataGrid.Columns> <data:DataGridTemplateColumn Header="Name"> <data

How can I change the properties of a DataGridTemplateColumn DataTemplate Element for a specific cell

和自甴很熟 提交于 2019-12-24 06:44:09
问题 I have a problem with my DataGrid I created a while ago. The DataGrid shows informations about project tasks. Now I have to make the start- and end-date column editable. For this purpose I changed the DataGridTextColumn with the following code: <DataGridTemplateColumn Header="Start" Width="100" CanUserReorder="True"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <DatePicker x:Name="DpStartDate" SelectedDate="{Binding PlannedStart, StringFormat=\{0:dd.MM.yyyy\}}" IsEnabled="False"/> <

Lost the text boxes values inside the filter menu

自闭症网瘾萝莉.ら 提交于 2019-12-24 03:45:22
问题 I writting a html/javascript page with a kendo grid with filter menu. I have faced the following problem: when I add a new object to the data source (new row) and its kendogrid is reloaded (datasource.read) I lose the textboxes values inside the filter menu that I was inputting the values. Here is the demo: http://jsfiddle.net/3qT3J/2/ $("#grid").kendoGrid({ dataSource: datasource1, height: 300, filterable: true // <== shows a button on each column that display a filter menu }); // reload the

In the built-in WPF DataGrid, can I set the datasource for a DataGridTemplateColumn?

筅森魡賤 提交于 2019-12-22 16:55:11
问题 In this hypothetical example, imagine I have an object FooSet that has five properties Foo1, Foo2, Foo3 Foo4 and Foo5 all of which are type Foo which itself has several properties. Finally, I have a DataTemplate called FooTemplate that knows how to display objects of type Foo in a graphical way. Now when using the built-in DataGrid, ItemsSource is a collection of FooSet objects. What I want to do is set up five templated columns that all use the FooTemplate data template. However, the

WPF DataGridTemplateColumn combobox updating all rows

妖精的绣舞 提交于 2019-12-22 09:19:53
问题 I have this XAML that selects a value from a combobox that the ItemSource is a Enum. The tutorial I used is: http://www.c-sharpcorner.com/uploadfile/dpatra/combobox-in-datagrid-in-wpf/ <DataGrid x:Name="dgProductItem" ItemsSource="{Binding ProductVersion.ProductItems}" <DataGridTemplateColumn Header="Deployment Type" Width="120"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding DeploymentType}"></TextBlock> </DataTemplate> </DataGridTemplateColumn.CellTemplate>

How to reuse WPF DataGridTemplateColumn (including binding)

倾然丶 夕夏残阳落幕 提交于 2019-12-21 07:23:56
问题 In WPF datagrids, I have a column defined as DataGridTemplateColumn which I'll need to be using on all kinds of columns. As a very simplified example please consider the below as a dummy sample: <DataGrid ItemsSource="{Binding Path=ItemList, Mode=OneWay}" AutoGenerateColumns="False" > <DataGrid.Columns> <DataGridTemplateColumn Header="Name" MinWidth="130" Width="Auto"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <DockPanel LastChildFill="True"> <Image Source="component/Images/test

WPF DataGridTemplateColumn with ComboBox Binding (MVVM pattern)

坚强是说给别人听的谎言 提交于 2019-12-17 19:09:26
问题 I'm going bonkers with the following WPF DataGrid+ComboBox scenario. I have a set of classes which look like; class Owner { int ID { get; } string Name { get; } public override ToString() { return this.Name; } } class House { int ID { get; } Owner HouseOwner { get; set; } } class ViewModel { ObservableCollection<Owner> Owners; ObservableCollection<House> Houses } Now my desired outcome is a DataGrid which shows a list of rows of type House , and in one of the columns, is a ComboBox which