c# - Flush grid layout of buttons in .Net for Windows Store App -
c# - Flush grid layout of buttons in .Net for Windows Store App -
i have grid of objects generating programmatically.
for testing purposes, each cell in grid border object kid image object. each cell placed flush against it's neighbour , displays perfectly.
when replace each image object button object (each cell still border object, button kid rather image), noticeable gap appears between cells.
i have tried setting margin, padding, et al 0.
what unique buttons makes them behave way, , how can overcome it?
margin defined in command template. can alter next these steps:
right click on button in designer , select edit template > edit copy... context menu.
in dialog select name new style , take want set it.
now find next block of xaml in style , set margin 0.
<border x:name="border" borderbrush="{templatebinding borderbrush}" borderthickness="{templatebinding borderthickness}" background="{templatebinding background}" margin="3"> <contentpresenter x:name="contentpresenter" contenttemplate="{templatebinding contenttemplate}" contenttransitions="{templatebinding contenttransitions}" content="{templatebinding content}" horizontalalignment="{templatebinding horizontalcontentalignment}" margin="{templatebinding padding}" verticalalignment="{templatebinding verticalcontentalignment}"/> </border> assign new style buttons either removing x:key style declaration:
<style targettype="button"> <!-- style definition --> </style> or setting style selected buttons:
<button style="{staticresource mybuttonstyle}"/> either way, you'll have buttons next each other without gap between them.
c# .net windows-store-apps
Comments
Post a Comment