Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

XAML button not triggering?

$
0
0

I have a XAML layout (see below), with a number of buttons. They were all previously working, but since I have updated some of the sizes and positions, one is not working any longer? It appears, but clicking it doesn't trigger the relevant C# code.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
             xmlns:local="clr-namespace:Gas_Sense;assembly=Gas_Sense"
             x:Class="Gas_Sense.HomePage"
             Title="Home Page">
    <ContentPage.Padding>
        <OnPlatform x:TypeArguments="Thickness" iOS="7, 40, 7, 10" />
    </ContentPage.Padding>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="120" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="30" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
             <ColumnDefinition Width="130" />
             <ColumnDefinition Width="*" />
             <ColumnDefinition Width="40" />
       </Grid.ColumnDefinitions>  
       <Button x:Name="NewDeviceButton" Image="add.png" 
               HorizontalOptions="Center"
               VerticalOptions="FillAndExpand"
               Grid.Row="7" Grid.Column="2" />
    </Grid>
</ContentPage>

The C# code is as follows:

NewDeviceButton.Clicked += async (sender, e) => {

    devices.Clear();
    adapter.StartScanningForDevices (0x180D.UuidFromPartial ());
}

I really can't understand why the button is rendering and displaying correctly, but not functioning?


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>