I have a keyboard modal window which is 9*9. And used it fill Sudoku game board. In android studio , to get the location of the button I used the following code
_selectedButton=(Button)view; int tag=(int)_selectedButton.getTag(); _currentRow=tag/9; _currentCol=tag%9; int[] location=new int[2]; _selectedButton.getLocationOnScreen(location); _p=new Point(); _p.x=location[0]; _p.y=location[1]; ShowKeyBoard();
ShowKeyBoard is like this
int offsetX=30; int offsetY=30; _popupWindow.showAtLocation(_keyBoardLayout, Gravity.NO_GRAVITY, _p.x+offsetX, _p.y+offsetY); After that he selects a key and I dismiss the popup window. public void BtnKey1Pressed(View view) { _selectedButton.setText("1"); _popupWindow.dismiss(); }
In Xamarin what I did until now is
protected void InitKeyBoard() { //Init KeyBoard _keyBoard = new AlertDialog.Builder(this); _keyBoard.SetView(LayoutInflater.Inflate(Resource.Layout.keyboard, null)); _keyBoard.Create(); } private void BtnGrdMatrix_Click(object sender,EventArgs es) { _keyBoard.Show(); }
How can I do that in Xamarin Android.? Is it possible to get return data like this in xamarin.?
What I want is
int selectedKey=ShowKeyBoard();