WPF Canvas Scaling/Transform to Fit

前端 未结 1 1139
面向向阳花
面向向阳花 2021-02-02 11:51

I\'m reposting this question as I didn\'t get much of a response last time, hopefully a bit of re-wording might help...

Essentially what I\'m trying to do is to create a

相关标签:
1条回答
  • 2021-02-02 12:50

    As your Canvas doesn't seem to have fixed width and height, I would include it into a Viewbox:

    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <Viewbox Stretch="Uniform">
                <Canvas x:Name="canvas" Background="DarkSeaGreen">
                    <Canvas.LayoutTransform>
                    <ScaleTransform ScaleY="-1" />
                    </Canvas.LayoutTransform>
                </Canvas>
            </Viewbox>
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
    

    Alternatively, place your entire UserControl into a ViewBox.

    0 讨论(0)
提交回复
热议问题