如何以Xamarin形式在特定网格中显示UserDialogs弹出框

时间:2019-02-05 14:28:05

标签: mvvm xamarin.forms dialog

我需要在单击xamarin表单中的图标时显示DatePrompt,但是用户对话框将显示在屏幕的左上角。有没有办法在图标旁边显示“用户对话框”。

<Image Grid.Row="1" Grid.Column="1" Source="Images/datePicker.png" WidthRequest="25" HeightRequest="25" Margin="-20,0,0,0" HorizontalOptions="End">
                    <Image.GestureRecognizers>
                        <TapGestureRecognizer Command="{Binding OnSelectDOBCommand}"  />
                    </Image.GestureRecognizers>
                </Image>

在ViewModelPage

 public Command OnSelectDOBCommand { get; set; }
 OnSelectDOBCommand = new Command(OnSelectDOB);

 private void OnSelectDOB(object obj)
    {
        //obj.Focus();

         UserDialogs.Instance.DatePrompt(new DatePromptConfig { MaximumDate = DateTime.Today, OnAction = (result) => SetDateOfBirth(result), IsCancellable = true });
    }

感谢您的帮助!

0 个答案:

没有答案