2015-09-03 18 views
7

के अंदर बाल नियंत्रण फॉर्म बनाता है मैं अपने xamarin फॉर्म एप्लिकेशन में एक बटन के अंदर कुछ बाल नियंत्रण रखना चाहता हूं। मैंने निम्नलिखित कोड को आजमाया लेकिन बाल नियंत्रण नहीं दिख रहे हैं।एक्समरिन बटन

<Button> 
<StackLayout Orientation="Horizontal"> 
    <Image Source="updatesite.png" HeightRequest="25" WidthRequest="25"/> 
    <Label VerticalOptions="Center" Text="Update Site and Settings" FontSize="16"/> 
</StackLayout> 
</Button> 

कृपया मेरी मदद करें।

उत्तर

10

आपको सभी सामग्री को ग्रिड जैसे लेआउट में लपेटना चाहिए। फिर पारदर्शी बटन ग्रिड पर रखें। इस तरह।

<Grid> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="25"/> 
     <RowDefinition Height="25"/> 
    </Grid.RowDefinitions> 
    <Image Grid.Row="0" Source="updatesite.png" /> 
    <Label Grid.Row="1" VerticalOptions="Center" Text="Update Site and Settings" FontSize="16"/> 
    <Button Grid.Row="0" Grid.RowSpan="2" x:Name="buttonDo" 
     BackgroundColor="Transparent" TextColor="Transparent" 
    /> 
</Grid> 

यह ग्रिड एक बटन की तरह कार्य करेगा जिसमें चिड्रेन होगा।

+0

अच्छा काम करता है, धन्यवाद! –

6

आप छवि और इस तरह बटन में पाठ रख सकता हूँ,

<Button BackgroundColor="Transparent" Image="updatesite.png" Text="Update Site and Settings" TextColor="Gray" ContentLayout="Top,0"/> 
संबंधित मुद्दे