Button Background does not cover the entire button in WP7 - windows-phone-7

When I set a background to a button it does not cover the entire button. There is some offset or padding with background and button. How do I make the background cover entire Button?
<Button.Background >
<ImageBrush x:Name="LoginImg" source="fv.img" ></ImageBrush>
</Button.Background>

You should get into button's style.
Or, probably, the easiest way (just workaround) is to use negative padding.

Related

WIN32: Is there a way to have the button icon (BM_SETIMAGE) on the right side of the text

Is there a way to have a button with text and graphic, with the graphic on the right side of the text, without having to owner-draw the button?
I want to just sent BM_SETIMAGE and whatever else would be needed so the graphic is to the right of the text.
Also, I noticed the image is so tight against the text that it doesn't look good. Is there a way to adjust the margin without having to use a blank space in the text?
Is there a way to have a button with text and graphic, with the graphic on the right side of the text, without having to owner-draw the button?
There are BS_LEFTTEXT and BS_RIGHTBUTTON styles available, but the documentation says they only apply to CheckBoxes and RadioButtons:
Constant
Description
BS_LEFTTEXT
Places text on the left side of the radio button or check box when combined with a radio button or check box style. Same as the BS_RIGHTBUTTON style.
BS_RIGHTBUTTON
Positions a radio button's circle or a check box's square on the right side of the button rectangle. Same as the BS_LEFTTEXT style.
For a standard push button, there does not appear to be a way to control the position of the image other than through owner-drawing.
Is there a way to adjust the margin without having to use a blank space in the text?
Use BCM_SETTEXTMARGIN/Button_SetTextMargin():
Sets the margins for drawing text in a button control.

How to make sure groupbox always fit in the screen?

I am trying to create app. In the form, there is only 3 button in a groupbox. I want to make the groupbox always fit in the screen. The problem is when i minimize the form, there is vertical and horizontal scroll. So i cannot see the whole groupbox border:
I want to make the groupbox to minimize without the scroll and i am able to see all the border just like when in the maximize screen as below:
I have already tried groupbox autosize to true while anchor to top, bottom, right, and left but it is still not working. Any idea how i can achieve this?
As #ib11 said you need to go to Dock and select Fill. In addition, if you want to make your group box not fill the form but grow with it, you'll probably need to change the Anchor to all sides. That's why your previous settings didn't work because anchor doesn't fill the screen, it's just a property to grow with the screen. Fill makes it possible so that you can have a group box or any other control always fill the screen.
See this image for dock:
See this image for anchor:
You need to set the Dock property of the GroupBox to Fill.
Like so:

Titanium - Android button "native" behavior upon styling

I've created 2 buttons:
<Button title="TEST"></Button>
<Button title="TEST" backgroundColor="red"></Button>
The first is a really simple default button. And the second I just added a red background color. The result is this:
As you can see from the picture, just adding a different background color changes the button a lot from it's "native" appearance. What I would expect is that the button will remain the same, just with a red background.
The "styled" button is bigger (and as you can see I did not set up any dimensions).
The "styled" button corners are no longer round.
Most bothering - the "styled" button no longer has the android button ripple effect upon clicking.
Why is that? Can it be fixed?
The native button (AppCompatButton) is a bit more complex and is not using the backgroundColor to show the actual color. I think it is using a 9-patch in the background so if you set a backgroundColor it will remove that and you end up with the box and the color.
Try using the tintColor to change the background color or you can fake it using:
borderRadius
elevation
touchFeedback
touchFeedbackColor

Changing click behaviour

When a Button having Content / Text 'ClickMe' is clicked, 'ClickMe' text is automatically arranged to foreground of the button.
But when user clicks the button having image on its background, background image becomes invisible & the foreground of button looks fully white.
Can we see the image on foreground instead of white color.
Is there any chance to change the foreground effect of the button when user clicks on button?
My Code "Button Height="128" HorizontalAlignment="Left" Margin="307,138,0,0" Name="button2" VerticalAlignment="Top" Width="150" BorderThickness="1">
"Button.Background>
ImageBrush ImageSource="/WinApp;component/Icons/camerabtn.png" />
/Button.Background>
/Button>"
Thanks in advance to all.
To do this you need to change the style of the button.
Easiest way to do that is in Expression Blend.
See this answer:
Windows Phone 7 (WP7) Change a button's background color on click
As Mick suggests, it would help to see some code for what you're trying to do, however, it sounds like you may have a change in a value (such as margin) in the Normal and Pressed states of the button resulting in the behavior you are seeing.

How can I change the way NSButtonCell objects highlight when clicked?

I am using several NSButtonCell objects in an NSTableView. They are simple square buttons with custom images on them.
These buttons draw properly when they are not highlighted: all that is visible is the image, and the rest of the button rectangle is transparent. However, when I click on them, the entire button rectangle is highlighted, inverting the background in the parts that were transparent.
I would prefer to see the image drawn inverted, and the transparent parts remain transparent. How can this be done?
Try setting your cell's highlightsBy property to NSContentsCellMask. I think you'll have to do this in code (probably in awakeFromNib); I don't see a way to do it in IB alone.
You can do it in Interface Builder too. I use "Square Button" so the button alters between two images (so the image is not inverted at all).
Your buttons behaviour is probably set to "Momentary Light" or "Momentary Push In".
Set the Behaviour to "Momentary Change", and it should work.

Resources