Answer the question
In order to leave comments, you need to log in
How to dynamically create columns in RadGridView?
Good evening everyone, habravchane. Forgive the young and inexperienced, but the problem is the following:
you need to dynamically create a table in which: 31 columns (30 or 28 depending on the month). Each column has 4 controls: 2 textboxes for reading and 2 textboxes for entering.
Example:
Data is stored in a sheet. Binding needs to be configured. =)
.Net 4.5; C#; Silverlight 5;
Thank you in advance.
Answer the question
In order to leave comments, you need to log in
Found a solution:
IrregGridView.Columns.Add(new GridViewDataColumn()
{
Header = x.DayNumber.ToString(),
HeaderTextAlignment = TextAlignment.Center,
TextAlignment = TextAlignment.Center,
Width = GridViewLength.Auto,
IsFilterable = false,
CellTemplate = (System.Windows.DataTemplate)
XamlReader.Load(@"<DataTemplate
xmlns='http://schemas.microsoft.com/client/2007'
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'>
<StackPanel Orientation=""Vertical"">
<TextBox Width=""28"" Height=""22"" Text=""{Binding Path= ModelVLimit}"" IsReadOnly=""true""
TextAlignment=""Center"" FontSize=""9"" />
<TextBox Width=""28"" Height=""22"" Text=""2"" IsReadOnly=""true""
TextAlignment=""Center"" FontSize=""9"" />
<TextBox Width=""28"" Height=""22"" Text=""3"" IsReadOnly=""false""
TextAlignment=""Center"" FontSize=""9"" />
<TextBox Width=""28"" Height=""22"" Text=""4"" IsReadOnly=""false""
TextAlignment=""Center"" FontSize=""9"" />
</StackPanel> </DataTemplate>")
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question