windows 10 - UWP - drop down button - xaml

I'm trying to have a 'drop down button'.
I don't know if the is the good naming, but I need to have :
But I really have no idea how to do it, or even how this is named.
Any idea ?

It's not exactly what is on your mock, but what about MenuFlyout? It's almost the same and you don't need any magic for that. Plus it feels native for UWP users:
<StackPanel>
<Button Content="Button 1">
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem Text="Action 1"/>
<MenuFlyoutItem Text="Action 2"/>
<MenuFlyoutItem Text="Action 3"/>
</MenuFlyout>
</Button.Flyout>
</Button>
<Button Content="Button 2"/>
<Button Content="Button 3"/>
</StackPanel>

There is API addition with DropDownButton in Windows 10 SDK Preview Build 17686 (line 487).
public class DropDownButton : Button

Been a while, but for anyone wondering, the image drawn more accurately represents a tree hierarchy then anything else
Try "TreeView" from there its standard intuitive coding

Related

Buttons in an AbsoluteLayout overlap other objects on Android

So I have an odd thing happening with last Xamarin update and I am not sure what to do about it.
I have a view
<ContentView.Content>
<AbsoluteLayout WidthRequest="100" HeightRequest="100">
<Button x:Name="BackgroundButton" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1" />
<Image x:Name="Icon" InputTransparent="True" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1" Margin="20,15,20,25"/>
<Label x:Name="CountLabel" Style="{StaticResource HubButtonLabel}" HorizontalTextAlignment="End" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1" />
<Label x:Name="ButtonLabel" Style="{StaticResource HubButtonLabel}" HorizontalTextAlignment="Center" VerticalTextAlignment="End" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1" />
</AbsoluteLayout>
</ContentView.Content>
</ContentView>
Is basically just a button wrapper, with some extra icons, and text. I have a few of these in the project of different layouts and styles. Until the last update they worked fine. Now the button renders overtop of everything else. I can confirm that by setting the button color to something semi transparent.
This only happens on Android, it still works as expected on ios
Anyone have a fix for that? or do I need to rework all these views?
Update - So while this isn't really a fix, but also kind of is. If I swap out the Button for an ImageButton - they work again as expected on both platforms.
Bug perhaps with button on Android?
Got an answer on another forum. - Apparently it is a known bug with an easy fix, https://forums.xamarin.com/discussion/comment/394729
Put
global::Xamarin.Forms.Forms.SetFlags("UseLegacyRenderers");
Before the xamarin init in Main Activity Oncreate.

UWPCommunityToolkit DropShadowPanel on Button

I'm trying to apply a shadow effect on a button on a UWP application.
I'm using the UWPCommunityToolkit tool and the control DropShadowPanel. Here an example :
http://www.uwpcommunitytoolkit.com/en/master/controls/DropShadowPanel/
So my code for apply on a button control :
<controls:DropShadowPanel BlurRadius="{Binding BlurRadius.Value, Mode=OneWay}"
ShadowOpacity="{Binding Opacity.Value, Mode=OneWay}"
OffsetX="{Binding OffsetX.Value, Mode=OneWay}"
OffsetY="{Binding OffsetY.Value, Mode=OneWay}"
VerticalAlignment="Center"
HorizontalAlignment="Center">
<Button Content="My button" />
</controls:DropShadowPanel>
But the result is :
The shadow cover all my button control.
According to the doc Button control doesn't directy inherit from FrameworkElement, that is maybe a reason.
Regards
Hum problem solved by using custom values :
<controls:DropShadowPanel BlurRadius="4.0"
ShadowOpacity="0.70"
OffsetX="5.0"
OffsetY="5.0"
Color="Black"
VerticalAlignment="Center"
HorizontalAlignment="Center">
<Button Content="My button" Background="Aqua" />
</controls:DropShadowPanel>

How do I set text wrapping property for a content of a button in Windows universal platform?

I could not find in Windows.UI.Xaml.Controls classes a property for a button to make its text move to the next line. For example for a TextBox I can do TextWrapping="Wrap" but what should we do for a button?
Try this
<Button Width="50" Height="50">
<TextBlock Text="Lengthy Data...." TextWrapping="Wrap" />
</Button>

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="" />

GridView Control (Windows 8) incorrectly rendered

Here's the code for the GridView Control that I'm using (made on BlankPage App):
<GridView HorizontalAlignment="Left" x:Name="gridView1" Margin="227,220,0,53" Width="1087">
<Button x:Name="XboxButton" Margin="10,10,10,10" Style="{StaticResource XboxButton}" Height="200" Click="SnappedXboxButton_Click_1"/>
<Button x:Name="PS3Button" Margin="10,10,10,10" Style="{StaticResource PS3Button}" Click="SnappedPS3Button_Click_1" />
<Button x:Name="PCButton" Margin="10,10,10,10" Style="{StaticResource PCButton}" Click="SnappedPCButton_Click_1" />
<Button x:Name="DSButton" Margin="10,10,10,10" Style="{StaticResource DSButton}" Click="SnappedDSButton_Click_1" />
<Button x:Name="PSPButton" Margin="10,10,10,10" Style="{StaticResource PSPButton}" Click="SnappedPSPButton_Click_1" />
<Button x:Name="ContactButton1" Margin="10,10,10,10" Style="{StaticResource ContactButton}" Click="SnappedContactButton_Click_1" />
<Button x:Name="PrivacyButton" Margin="10,10,10,10" Style="{StaticResource DisclaimerButton}" Click="SnappedPrivacyButton_Click_1"/>
</GridView>
The problem is when the app first loads it shows the GridView is shown like this:
(Please go here, since, I'm new, I'm not allowed to post images)
http://social.msdn.microsoft.com/Forums/getfile/189014
But when I click any item and GO BACK to the first page the render is fine as shown in this image:
http://social.msdn.microsoft.com/Forums/getfile/189015
Improve tour markup.
1. In the GridView define a style resource for buttons, or in app resources create a base style and then use it in each button style using BasedOn={StaticResource binding notation
2. Set the margin,width,height , as I see all buttons have same property values
3. Id you don't want GridView set width or height values automaticly, ensure you set the values in the styles