0

I have an entry surrounded by stacklayout and for the stack I added GestureRecognizers like below:

     <StackLayout>
            <Entry
                TextColor="Black"
                x:Name="phoneone"/>
                <StackLayout.GestureRecognizers>
                    <TapGestureRecognizer
                            Tapped="CallingPhone1"
                            NumberOfTapsRequired="1">
                    </TapGestureRecognizer>
                </StackLayout.GestureRecognizers> 
        </StackLayout>

My CallingPhone1 code:

public async void CallingPhone1(object sender,EventArgs args)
     {
            Debug.WriteLine("Enter1");
            var answer = await DisplayAlert("Alert", "Do you want to call this number?", "Yes", "No");
            if (answer)
            {
                string firstphone = phoneone.Text;
                try
                {
                    PhoneDialer.Open(firstphone);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine("Exception:>>" + ex);
                }
            }
        }

When I Tap on the Entry, noting is happening in UWP. But showing The thread 0x6adc has exited with code 0 (0x0) in output box. I am using xamarin.forms 2.5.0.121934

Thanks in advance

Sreejith Sree
  • 3,055
  • 4
  • 36
  • 105
  • If you want the tap recognizer on the entry, why you put it into the stacklayout, you could use the focused event of the entry. But why do you even want this event (confirm calling) on an entry?! An entry is there to give input – Johannes May 28 '18 at 05:47
  • Hi @Johannes: I am using this entry for two cases, in the normal case the entry is in disable state and when tap on the entry user got alert for the call. When the user needs to edit the profile then the entry will be enabled for editing. – Sreejith Sree May 28 '18 at 05:56
  • So... why not use the `focused` event of the entry? – Johannes May 28 '18 at 05:58
  • Because in disable state focused event not fire – Sreejith Sree May 28 '18 at 06:14
  • I need to activate the call feature when the entry is in disable state, if the user enable the entry means, he is going to perform edit operation – Sreejith Sree May 28 '18 at 06:18
  • @Johannes I think this problem is related with packages – Sreejith Sree May 28 '18 at 06:24
  • My guess is that the entry "catches" the `Tapped` event of the stacklayout, because it probably takes the whole size, there is no space left for the layout container. But then I wonder how it would work on android and iOS. What you could try is overlapping things, put your entry in a grid, add a transparent box view over your entry and add the taprecognizer to this one. – Johannes May 28 '18 at 06:25

0 Answers0