Поверните Windows.Documents.Table
Мне нужно повернуть стол по часовой стрелке до 90 градусов. Это один из блоков FlowDocument. Есть ли способ применить какое-то вращение к таблице?
Возможное решение создания TextEffect выглядит так:
var table = new Table();
... // fill the table here
var effect = new TextEffect
{
Transform = new RotationTransform(90),
PositionStart = 0,
PositionCount = int.MaxValue
};
table.TextEffects = new TextEffectCollection();
table.TextEffects.Add(effect);
не работает
1 ответ
Решение
Решено так:
Вместо вращающегося стола поместите его в контейнер и выполните вращение на нем.
var container = new BlockUIContainer
{
Padding = new System.Windows.Thickness(0),
Margin = new System.Windows.Thickness(0)
};
var scrollViewer = new FlowDocumentScrollViewer
{
VerticalScrollBarVisibility = ScrollBarVisibility.Hidden,
LayoutTransform = new RotateTransform(90)
};
container.Child = scrollViewer;
var tableDocument = new FlowDocument { PagePadding = new System.Windows.Thickness(0) };
// here the table is created
var table = operationStagesControl2.ConvertToXaml();
// adding table to document
tableDocument.Blocks.Add(table);
// hosting scroll viewer gets document
scrollViewer.Document = tableDocument;
// and in the end we have container with rotated table inside it