Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8262093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:38:48+00:00 2026-06-08T03:38:48+00:00

I have a custom button control used in my application, and the textwrapping on

  • 0

I have a custom button control used in my application, and the textwrapping on everyone is set to wrap for translation purposes. When testing, I found that some strings in various languages wrap according to my specifications, although the button height stays the same, and therefore the second line of text is cut off from view. Now I set each button style in xaml from a custom button style in my ResourceDictionary, but I cannot figure out how to adjust the button height accordingly from the ResourceDictionary (in which case I would only have to change the button style once, instead of manually on every single button which I can do). How would I go about updating by custom button style in my resource dictionary so that the height automatically adjusts accordingly to when the text is wrapped? An example of the button implementation is as follows:

MainPage.xaml

<Button x:Name="btnUseEmailAddress" Style="{StaticResource GlassButton}" Click="btnUseEmailAddress_Click" Margin="0,10">
                        <Button.Content>
                            <TextBlock TextWrapping="Wrap" Text="{Binding Path=LocalizedResources.MainPage_Contacts_UseContactsEmailAddress, Source={StaticResource LocalizedStrings}}"/>
                        </Button.Content>
 </Button>

ResourceDictionary.xaml

<Style x:Key="GlassButton" TargetType="Button">
    <Setter Property="FontSize" Value="25.33" />
    <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}" />
    <Setter Property="Height" Value="60"/>
    <Setter Property="Padding" Value="10,3,10,5"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="Button">
                <Border x:Name="ButtonBorder" 
              CornerRadius="30" 
              BorderThickness="4,4,4,4" 
              Background="#AA000000"  
              BorderBrush="#99FFFFFF"
              RenderTransformOrigin="0.5,0.5">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="1.7*"/>
                        </Grid.RowDefinitions>
                        <Border Grid.Row="0" CornerRadius="23,23,0,0">
                            <Border.Background>
                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                    <GradientStop Color="#08FFFFFF" Offset="0"/>
                                    <GradientStop Color="#88FFFFFF" Offset="1"/>
                                </LinearGradientBrush>
                            </Border.Background>
                        </Border>
                        <ContentPresenter x:Name="ButtonContentPresenter"
                            VerticalAlignment="Center"  
                            Grid.RowSpan="2" 
                            HorizontalAlignment="Center"/>
                    </Grid>
                </Border>
                <!--<ControlTemplate.Triggers>
                    <Trigger Property="IsPressed" Value="True">
                        <Setter Property="RenderTransform" TargetName="ButtonBorder">
                            <Setter.Value>
                                <TransformGroup>
                                    <ScaleTransform ScaleX="0.9" ScaleY="0.9"/>
                                </TransformGroup>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                </ControlTemplate.Triggers>-->
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

To note, the Glass button style as of currently looks great and is exactly what I want, except for when the text is wrapped. I can adjust the button height to auto in the MainPage.xaml using <Button x:Name="btnUseEmailAddress" Height="Auto"... but I would have to do this for every single button (which is a lot!). So is there any way to accomplish this in the glass button style?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T03:38:50+00:00Added an answer on June 8, 2026 at 3:38 am

    I would suggest changing the Height property to MinHeight. This will set the height to 60 for most cases, but if the text does need to wrap the height will grow.

    Change:

    <Setter Property="Height" Value="60"/>
    

    To:

    <Setter Property="MinHeight" Value="60"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom control that displays a tryAgain button when the control is
I have a custom button control created using ATL. This control is used by
I'm making a custom button (Winforms Control Library) and have the code below so
I have to create a custom compound button bar control in Android like the
I have custom server control contains templatefield when an out button clicked the field
Check out this jsbin . I have a form with a custom button that
I have a custom ButtonUI class that paints the button. Before drawing the text,
I have one sharepoint custom page application which is rendering from a user control.
I have a HorizontalList control that uses a custom ItemRenderer to represent each item
I have a custom control that is derived from ListView . This list view

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.