0

I have the following layout for a screen displaying multi-channel information (similar to audio tracks):

  1. MultiChannelPlotterControl contains one HorizontalRuler instance at the bottom and a UniformGrid containing N SingleChannelPlotterControl instances;
  2. Each SingleChannelPlotterControl has one instance of VerticalRuler aligned to left;

enter image description here

Problems are:

  1. Each vertical ruler can have a different Width, but I would like them all to stretch to the largest width so that they could fit, but since they are on different controls, I cannot put them in the same container (another UniformGrid, for example. Now if I decide to put them together in a different container, they would not be part of the SingleChannelPlotterControl anymore;
  2. There is a rectangular region on the bottom left corner. That is supposed to have the same Width of the VerticalRuler(s), but it is still higher in the layout tree. It is currently empty, but I could put something there and bind its Width, for example;

So the question is:

How could I Layout/Element-Bind/Style these controls so that right edge of the Vertical Rulers keep aligned to each other (fitting the widest one) and with the left edge of the Horizontal Ruler?

EDIT: I guess I could create a "LeftPanelWidth" DependencyProperty on MultiChannelPlotterControl, and on its getter use some VisualTreeHelper wizardry to get ActualWidths for every VerticalRuler inside, but how would I choose the largest width and set the widths of the others?

4

2 に答える 2

0

SingleChannelPlotterControlクラスを排除することで問題を解決することになりました。

UniformGrid代わりに、2 つのインスタンスを( ItemsPanel2 つのインスタンスの として)並べて使用し、XAML で宣言されたものと同じItemsControlに設定します。ItemsSourceCollectionViewSource

次に、それぞれに対してItemsControl異なる を宣言しますItemTemplate。左側には が含まれVerticalRuler、もう 1 つは以前と同じ方法でシグナルを表示しSingleChannelPlotterControlていますが、ルーラーが含まれていないことを除きます。

于 2016-01-19T16:58:09.760 に答える