2010-04-27 7 views
0

Je dois faire pivoter une table dans le sens des aiguilles d'une montre jusqu'à 90 degrés. C'est l'un des blocs d'un FlowDocument. Existe-t-il un moyen d'appliquer une sorte de rotation à une table?
La solution possible de créer TextEffect comme ceci:Rotation de Windows.Documents.Tableau

 

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); 
 

ne fonctionne pas.

Répondre

0

Résolu comme ceci:
Au lieu de faire pivoter la table, placez-la dans un récipient et faites-la tourner.

 
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