私はカスタムコントロールを持っています。リストボックスやコンボボックスのようなitemscontrolのように動作します。項目はセルです。アイテムはこれらのセルのコレクションにバインドされています。私のコントロールautomaticalyは、これらのセルをグリッド(9x9ボード)にレイアウトします。印刷 - itemssourceを強制的に更新する方法
私のコントロールをアイテムに配置すると、すべてが見栄えがよく、細胞が存在します。
問題は、ドキュメントのページ設定を使用してコントロールを印刷しようとするときです。コントロールが印刷されていますが、空です。項目がありません。これは、コントロール自体が更新され、バインドされた値をロードするために、何らかの形で再描画または通知する必要があるようです。すべての手がかりをお願いしますか?
private UIElement generateGridControl(SudokuFile file, int row, int column)
{
//Contsruct control
View.GridControl.GridControl grid = new View.GridControl.GridControl();
//Create sudoku data from provided file
Grid model = new Grid(file.Type, file.ID);
model.setValues(file.Data);
//Create new viewmodel for my control and inject it to control
grid.init(new GridVM(model), file.Save);
//Set appearance
grid.Width = 500;
grid.Height = 500;
grid.showLabel(true);
//Create viewbox used to stretch control to desired size and wrap it around my usercontrol
System.Windows.Controls.Viewbox box = new System.Windows.Controls.Viewbox
{Stretch = System.Windows.Media.Stretch.Uniform, Child = grid};
System.Windows.Controls.Grid.SetRow(box, row);
System.Windows.Controls.Grid.SetColumn(box, column);
box.Margin = new Thickness(5);
return box;
}
私はドキュメントpaginatorについて全く知らないけど、あなたのViewBoxは決して完全なレイアウト/レンダリングサイクルを取得しないと思います。それを返す前に 'box.UpdateLayout()'を試してください。 – Clemens