0

I am using WPF to create an interactive touch-based application. The application uses ScatterViewItem objects to hold two scrollable menus inside, a main menu and a sub-menu side by side and display various content depending on the items selected.

By default, the ScatterViewItem is scalable using touch gestures, but the problem is that only the container itself grows/shrinks in size, while the items simply move further apart or closer together inside it.

Example: enter image description here

What I wish for to happen is for the container and everything inside it to scale proportionately, just like an image would, for example.

I've tried using a ViewBox to wrap all the contents inside, but this caused a host of new problems:

  1. The once scrollable menus (SurfaceScrollViewer) are now automatically scaled so that they fit entirely inside the container. This is bad since the individual item size changes depending on the amount of items in the sub-menu. I need them to stay scrollable, and for the same amount of items (roughly 3x3) to be able to fit in the container no matter the total count.

  2. TextBox controls now change their font sizes depending on the content length to fit the text in one line. I wish for the font size to stay uniform across all items, wrapping around to the next line if necessary.

What would be best approach for this? Should I just use some kind of binding to have a fixed proportion between each object's dimensions and its parent container's dimensions?

I have very limited C#/WPF experience and a tight schedule so any suggestions and/or examples would be very welcome.

Sir Rufo
  • 18,395
  • 2
  • 39
  • 73
eliba
  • 140
  • 10
  • Can you post the xaml you currently have? Could you try to set the properties `HorizontalAlignment` and `VerticalAligment` of the `ScatterViewItem`s to a value of `Stretch`? – Martin Sep 13 '15 at 00:08
  • Most of the controls are actually implemented in C# in the code behind. Basically the hierarchy is: `ScatterViewItem` -> `Border` -> `Grid` -> and both menus are `SurfaceScrollViewer`s. I have set the alignment properties as you suggested, but haven't noticed any difference. Or did you mean for me to try that with the `ViewBox` included under the `ScatterViewItem` ? – eliba Sep 13 '15 at 14:52

0 Answers0