none
display fractions

    Question

  • How do I display a fraction in silverlight?  I can write 1/2 =0.5    but can i write numbers on top and below a line?

    Tuesday, March 17, 2009 6:19 PM

Answers

  • This is a second workarround:

            <Canvas>
                <TextBlock FontSize="40" Text="1"/>
                <TextBlock FontSize="40" Text="_"/>
                <TextBlock FontSize="40" Text="2" Canvas.Top="40"/>
                <TextBlock FontSize="40" Text=" = 0.5" Canvas.Top="19" Canvas.Left="22"/>
            </Canvas>

    There isn't a FontStyle or TextDecoration for upper and lower font. The only approach (in my knowledge) is to manualy positioning the text.

     

    Tuesday, March 17, 2009 7:00 PM

All replies

  • I know that is not the best option, but is a first workarround!

            <StackPanel Orientation="Horizontal" Width="200" Height="100">
                <StackPanel Orientation="Vertical">
                    <Grid>
                        <TextBlock FontSize="40" Text="1"/>
                        <TextBlock FontSize="40" Text="_"/>
                    </Grid>
                    <TextBlock FontSize="40" Text="2" Margin="0,-18,0,0"/>
                </StackPanel>
                <TextBlock FontSize="40" Text=" = 0.5" VerticalAlignment="Center"/>
            </StackPanel>

    Tuesday, March 17, 2009 6:57 PM
  • This is a second workarround:

            <Canvas>
                <TextBlock FontSize="40" Text="1"/>
                <TextBlock FontSize="40" Text="_"/>
                <TextBlock FontSize="40" Text="2" Canvas.Top="40"/>
                <TextBlock FontSize="40" Text=" = 0.5" Canvas.Top="19" Canvas.Left="22"/>
            </Canvas>

    There isn't a FontStyle or TextDecoration for upper and lower font. The only approach (in my knowledge) is to manualy positioning the text.

     

    Tuesday, March 17, 2009 7:00 PM