0

I'm writing an application on a Windows Compact 2013 device and wish to use Silverlight to get rich UI elements. The Silverlight forms created from Expression Blend can only be used with C++ and not C#.

Is it possible to do this with C#, or are there any other alternatives to Silverlight for a good-looking UI?

Aneesh
  • 1
  • 2

1 Answers1

1

You are actually adding an empty row between controls, i.e.: Grid.Row="0" for Label and Grid.Row="2" for Button. It should be in sequential order like shown below::

    <Label x:Name="Screen"
           Text=""
           Grid.Row="0" Grid.Column="0"
           Grid.ColumnSpan="4"
           FontSize="50"
           TextColor="Black"
           BackgroundColor="White"
           HorizontalTextAlignment="End"
           VerticalTextAlignment="End"/>

    <Button x:Name="Button1"
            Text="1"
            FontSize="40"
            TextColor="White"
            BackgroundColor="Aquamarine"
            Grid.Row="1" Grid.Column="0"
            Clicked="Button1_Clicked"/>

I would also recommend for the task of making a calculator (like the working app at http://www.shopdigit.com/Engineering-Calculator-VOLTA-814-R814-0-03.htm) use the separate resource file and make sure to set the properties

<ContentPresenter VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>

You can also use 'center' property like in sample actual implementation:

<!--TEXT BLOCK-->
<Style x:Key="TextBlock_Generic">
    <Setter Property="TextBlock.VerticalAlignment" Value="Center"/>
    <Setter Property="TextBlock.HorizontalAlignment" Value="Center"/>
    <Setter Property="TextBlock.Padding" Value="0"/>
    <Setter Property="TextBlock.Margin" Value="0"/>
    <Setter Property="TextBlock.FontSize" Value="14" />
</Style>

Hope this may help.

Alexander Bell
  • 7,842
  • 3
  • 26
  • 42
  • I've not included the entire code here. In a later part, I'm using this row. I'm actually make a calculator and the '+', '-', '*' and '/' go into row 1 and the numbers 1,2,3... start from row 2 onwards. – Aneesh Oct 10 '17 at 01:10
  • Read my extended answer. Also, it would be better if you include that entire code snippet, otherwise it's hard to reproduce the issue. Best regards, – Alexander Bell Oct 10 '17 at 01:21
  • Thanks a lot! I'll upload the entire code asap and try this as well. – Aneesh Oct 10 '17 at 01:56