got this if I try to change Borders in code behind:
Table Kopf =
new
Table();
TableBorders tb =
new
TableBorders();
tb.All.Style = BorderStyle.None;
So how can I set the Borders in code behind.
Its really boring to search for this property to set for hours and hours :(
Kind Regards
Manfred
7 Answers, 1 is accepted
The Border class is immutable - it cannot be modified after it is initialized. If you want to set all table borders to None, you should set the the TableBorders.All property to an new instance of the Border class. Here is an example:
Table table =
new
Table();
table.Borders.All =
new
Documents.Model.Border(BorderStyle.None);
I hope this helps.
Kind regards,
Alex
the Telerik team
table.Borders.All
property is ReadOnly. Finally, how I can set properties for the table borders?
Regards
how did you do that?
Remember, you can only set that the way Alex described:
wrong:
Table Kopf =
new
Table();
TableBorders tb =
new
TableBorders();
tb.All.Style = BorderStyle.None;
Right:
Table table =
new
Table();
table.Borders.All =
new
Documents.Model.Border(BorderStyle.None);
Best Regards
Manfred
Please see the attached picture. What am I missing here?
Regards,
Stergios
The setter of the All properties of the border has been removed in the latest versions. The correct way of setting the borders of a table is either by creating a new Telerik.Windows.Documents.Model.Border instance and setting it to the table:
private
void
addTableWithBorders_Click_1(
object
sender, RoutedEventArgs e)
{
RadDocument document =
new
RadDocument();
Section section =
new
Section();
document.Sections.Add(section);
section.Blocks.Add(
new
Paragraph());
Table table =
new
Table(2, 3);
table.Borders =
new
TableBorders(
new
Border(BorderStyle.Single));
section.Blocks.Add(table);
this
.editor.Document = document;
}
or using styles:
table.StyleName = RadDocumentDefaultStyles.DefaultTableGridStyleName;
I hope this helps.
Kind regards,
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
I prefer to use the styles approach.
Where can I find examples of how to create and manage styles in a RadDocument?
Regards,
Stergios
You can find information about styles in this article.
When it comes to the names of the default styles, they are exposed as properties of RadDocumentDefaultStyles as can be seen in the previous post, which sets the StyleName of the table.
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.