In Windows 8.1 XAML/C# app, how can I style the buttons precisely? -
i'm new windows 8.1 development, forgive me if answer obvious, i've been beating on awhile, , can't work. here's situation:
i made usercontrol in order style button adding additional functionality it. here's code that:
<usercontrol x:class="mycalculator.calculatorbutton" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:mycalculator" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:designheight="300" d:designwidth="400" mc:ignorable="d" > <!-- grid takes whole width , height --> <grid x:name="layoutroot"> <grid.rowdefinitions> <rowdefinition height="*" /> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition width="*" /> </grid.columndefinitions> <!-- button takes whole size of grid --> <button verticalalignment="stretch" horizontalalignment="stretch" borderbrush="blue" borderthickness="1" background="aliceblue" padding="0" content="how can make bigger?" foreground="blue" grid.row="0" grid.column="0" /> </grid> </usercontrol>
here's looks in designer:
you'll notice button appears centered both horizontally , vertically, , rather small. however, when click button in code, entire size of grid (which takes whole 400 x 300 area in designer) filled button.
so button filling grid, filling area. border , background of button super-small, in middle of button. worse yet, doesn't stretch contain text. not desired , feel.
what trying do? want aliceblue button background fill entire grid, fills entire 400 x 300 area. i'd 'how can make bigger?' blue content string centered vertically , horizontally in big swath of aliceblue-ness result.
i've tried innumerable combinations of specifications of margin, padding, height, width, , other attributes on grid , on button. nothing has affected size or placement of aliceblue area of button.
clearly i'm missing something. can me understand is, , how can format button (or usercontrol in general) way want to?
thanks in advance help!
instead of assigning string value content property have tried put in textblock child element? might give more control hi. button has horizontalcontentalignment , verticalcontentalignment can set. , can modify horizontalalignment , verticalalignment of child textblock inside button independently.