button with 2 images and text in xamarin forms

别等时光非礼了梦想. 提交于 2021-02-08 10:14:20

问题


I am trying to create a button with two images on it. One at left side and one at right side and text in center. After searching I got a button with image only so I wanted to know if it is posible to create a button as I described above in xamarin?

I am trying to create button like this and also I want to change arrow image on the button click to up arrow and down arrow. Is it posible in xamarin to create button like this or should I think about another option any idea?


回答1:


You can't directly do this with the Button from Xamarin Forms as it doesn't support images yet.

From your requirement what you can do is create a horizontal stacklayout and add the images and a label to it. Also set a background color so that it would look like a button. To make it work like a button, add a Gesture recognizer to the stack layout and add the tap gesture. You can handle the event for tapping or bind it via command if you are using MVVM.



来源:https://stackoverflow.com/questions/38991845/button-with-2-images-and-text-in-xamarin-forms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!