0

次のレイアウトを定義しました。

<Grid Name="RootGrid" Background="{StaticResource WindowBackground}" >
        <s:ScatterView Name="RootScatter">
            <Viewbox>
                <s:LibraryContainer Name="RootContainer" Grid.Row="0" ViewingMode="Bar">
                    <s:LibraryContainer.BarView>
                        <s:BarView Rows="2" NormalizedTransitionSize="2.5,0.8" ItemTemplate="{StaticResource ContainerItemTemplate}">
                        </s:BarView>
                    </s:LibraryContainer.BarView>
                    <s:LibraryContainer.StackView>
                        <s:StackView NormalizedTransitionSize="1,1" ItemTemplate="{StaticResource ContainerItemTemplate}">
                        </s:StackView>
                    </s:LibraryContainer.StackView>
                </s:LibraryContainer>
            </Viewbox>
        </s:ScatterView>
        <s:ScatterView Name="ClassScatter"></s:ScatterView>
    </Grid>
</s:SurfaceWindow>

次に、アイテムを2番目のScatterViewに動的に追加します。

public void expand(SurfaceWindow1 surfaceWindow)
        {
            Logging.Logger.getInstance().log("Expand class " + name);

            if (!isExpanded())
            {
                Viewbox vb = new Viewbox();
                SurfaceTextBox txt = new SurfaceTextBox();
                txt.Text = this.name + "\nLOC: " + this.getLoc() + "\nFanIn: " + this.getFanIn() + "\nFanOut: " + this.getFanOut() + "\nComplexity: " + this.getComplexity();
                txt.IsReadOnly = true;

                vb.Child = txt;
                surfaceWindow.ClassScatter.Items.Add(vb);
                this.setExpanded(true);
            }
        }

これはうまく機能しますが、残念ながら、作成されたオブジェクトのサイズを変更したり、移動したり、回転したりすることはできません。なぜヒントはありますか?

4

1 に答える 1

1

問題は、TextBoxがタッチコンタクトをキャプチャし、ScatterViewがTextBoxのドラッグ/ズーム/回転のためにそれらをキャプチャできないことです。問題を解決するには、次の2つのオプションがあります。

  1. アイテムを移動可能にするが、ユーザーが編集できないようにする場合は、SurfaceTextBoxを通常のTextBlockに置き換えます。
  2. それでもテキストを編集できるようにする場合は、TextBoxに余白を追加して、要素の周囲に「ドラッグゾーン」を作成します。例えば:txt.Margin = new Thickness(20);
于 2010-10-27T08:47:06.110 に答える