Windows phone 8 Button style is transparent - xaml

My button looks like a text field instead of a button. Here's a screenshot:
Here's the code:
<Button FontWeight="Bold" Click="setWallpaper" Foreground="black" FontSize="35"
Margin="62,560,127,48" >Set Lockscreen</Button>
How do I fix it and make it look like a good old button?

Looks like the problem is that you have an image as your background and the button is transparent so it is showing the image. Just change your button background to White and it should fix it
<Button FontWeight="Bold" Click="setWallpaper" Foreground="Black" FontSize="35" Background="White" Margin="62,560,127,48" >Set Lockscreen</Button>

Related

Button appears all black in dark theme - Windows 11 (WinUi 3)

I am develop a new app for Windows 11 with WinUi 3 and in my MainPage the button appears all black in dark theme:
Why this happen?
This is a resume of my code:
<Window
<Grid Name="Main" RowDefinitions="Auto,*">
<RelativePanel Grid.Row="0"
Background="{ThemeResource SystemControlAcrylicWindowBrush}">
<TextBlock Name="TextBlock_AAA"
Text="AAA">
</RelativePanel>
<RelativePanel Grid.Row="1">
<Button Name="Button_AAA"
Content="AAA"
Click="AAA_Click"/>
</RelativePanel>
</Grid>
</Window>
#Luís, you're putting your UI directly in your window which is why it is not being styled.
Add a Blank Page (from the WinUI tab in VisualStudio) called something like "MainPage" and move your Grid into the XAML for the Page.
In the XAML for your main window, simply put <local:MainPage/> as the only content.
Now your button will look like the one in the comment by #nico-zhu-msft

Windows Phone 8.1 XAML Image inside ToggleButton adds mystery padding

I'm working with a toggle button and rather than show text I want to show an image so I have this:
<ToggleButton Grid.Column="1" IsChecked="true" MinWidth="50" MinHeight="0" BorderThickness="0" HorizontalAlignment="Center">
<Image Source="ms-appx:///Assets/Icons/phonebutton.png" Stretch="None" RenderTransformOrigin="0.5,0.5" Margin="0">
<Image.RenderTransform>
<CompositeTransform ScaleX="0.5" ScaleY="0.5"/>
</Image.RenderTransform>
</Image>
</ToggleButton>
I have the transform to make the image a bit smaller so it's "inside" the button instead of filling it.
However, no matter what I do the button has a large padding around the image, even though the image itself has no margins or padding. I've set margin=0 on everything but the ToggleButton insists on putting space around the image, so the button is larger than it needs to be and cuts off inside the grid row it's in (which has a height="*")
I want the toggle button to "shrink" to fit in the row but still show the full image inside ...
while typing this the autosuggest found this link ToggleButton does not fill the area(windows phone) and by adding the style PhoneTouchTargetOverhang it does look better but then cuts off the image at the bottom unless I add negative padding to the togglebutton.
Anyone have any idea what I'm doing wrong?
Is there any way to disable it?
I have added the following margin to an image of 512x512:
<Image Source="/Assets/award4.png" Stretch="None" RenderTransformOrigin="0.5,0.5" Margin="-100,0,-100,0">
<Image.RenderTransform>
<CompositeTransform ScaleX="0.5" ScaleY="0.5"/>
</Image.RenderTransform>
</Image>
And it fits centered

Inmobi ads Displayed issue on Windows Phone 8

I want to set the Inmobi ads on the bottom of the screen.
In XAML i set the Horizontal and Vertical alignment in bottom. when i saw the design i saw the AdView in bottom of screen but when i deploy it By default it appear in Middle.
I'm confused am i did mistake anywhere either it always appear on that place.
<StackPanel x:Name="ControlPanel" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0,0,0,55" Grid.Row="3" Width="480" >
<Ad:IMAdView
x:Name="AdView1"
RefreshInterval="30"
AdSize="15"
AppId="fcc4c048-4686-42bc-a40c-b7fe8da70b40"
Height="110" Width="480"
AnimationType="SLIDE_IN_LEFT" HorizontalAlignment="Right" VerticalAlignment="Bottom"
Margin="0,0,0,30" >
<Ad:IMAdView.IMAdRequest>
<Ad:IMAdRequest
LocationInquiryAllowed="False"/>
</Ad:IMAdView.IMAdRequest>
</Ad:IMAdView>
</StackPanel>
Changing your stackpanel's HorizontalAlignment property from "Center" to "Right" will work for you...

Change Color of Segoe UI Font Button Windows 8

How can I change it so that any button I create for my Windows 8 app has a differently-colored Segoe UI glyph than the default (white)? I tried the following to no avail:
<Button Style="{StaticResource AppBarButtonStyle}"
AutomationProperties.Name="Button" Content="">
<Button.ContentTemplate>
<DataTemplate>
<Path Fill="red"/>
</DataTemplate>
</Button.ContentTemplate>
</Button>
My hopes were that this would create a solid red circle for a button rather than a white one, but it renders nothing at all instead. Help greatly appreciated!
Use Foreground property.
<Button Style="{StaticResource AppBarButtonStyle}" Foreground="Red"
AutomationProperties.Name="Button" Content="" />

Button with image and stackpanel with text misses the mouse click event in Windows Store App?

In my Windows Store App I use a button which has a star shape with some text. I use the following XAML code for the button:
<Button Name="goButton" BorderThickness="0" FontWeight="Bold" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,-91,33,0" FontSize="25" IsEnabled="True" Click="goButton_Click" >
<Grid Width="227" Height="222">
<Image Source="Assets/redstar.png" />
<StackPanel Orientation="Vertical" Margin="77">
<TextBlock TextAlignment="Center" Text="Tag"></TextBlock>
<TextBlock TextAlignment="Center" Text="ist um!"></TextBlock>
</StackPanel>
</Grid>
</Button>
This is what is the button looks like:
Unfortunately it often happens that clicks in the area of the star are not recognized, e.g. the event handler is not startet. I suppose that it has something to do with the image, for it works fine if I remove the image from the grid. But this doesn't solve my problem.
Any suggestions?
Don't see anything wrong off the top. You could try a couple of things:
Instead of click, try the Tapped event for the button.
Try tapped on the container Grid.
Get rid of the Grid & put all button content in a StackPanel & then try tapped/clicked on it.
Go with patterns like MVVM & associate your button with a Command.
Hope these help!