Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to use grids "inside" of a button

$
0
0

Hi, I am trying to create a virtual keyboard so I want to create a button where I want certain characters to appear at specific locations.  For example, for the "1" key, I want the character "1" to be larger and located at the lower left corner.  Then, I want the character "!" to be smaller and located at the top left corner.  

My initial thought is to create a 2 x 2 grid (outer uses row definitions and inner uses column definitions) inside the button with Height and Width set to the desired percentages.  In each cell of the grid, I will use a viewbox with a TextBlock.  The problem I am having is the grid is not filling up the entire size of the button.  The width of the outer grid is very slim and does not expand to the width of the button.  The height is okay.  If I put in a hardcoded number for the width, it seems to work but "Auto" does not do it.  I tried using Stretch and put the grid in a viewbox but nothing works.  Does anyone know what I need to do?  Thank you.


Viewing all articles
Browse latest Browse all 18858

Trending Articles