Pergunta

I'm trying to draw a circle in WP7 Silverlight using EllipseGeometry instead of Ellipse. The sample XAML in MSDN does not display anything on the canvas in Visual Studio. If I run the app, it does display in the emulator.

<Canvas> 
    <Path Fill="Gold" Stroke="Black" StrokeThickness="1">
        <Path.Data>
            <EllipseGeometry Center="50,50" RadiusX="50" RadiusY="50" />
        </Path.Data>
    </Path> 
</Canvas>

Any ideas what is happening?

Foi útil?

Solução

For some unclear reasons, you should assign Width and Height.

  <Canvas>        
        <Path Width="100" Height="100" Fill="Gold" Stroke="Black" StrokeThickness="1">
            <Path.Data>
                <EllipseGeometry Center="50,50" RadiusX="50" RadiusY="50" />
            </Path.Data>
        </Path>
    </Canvas>

In blend, you will not have this issue.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top