我有一个自定义控件PickerWithDropdownIcon
,它是一个AbsoluteLayout
,其中包含Picker
和其他控件。我想知道是否有一种方法可以从使用Picker
控件的XAML访问内部PickerWithDropdownIcon
。
PickerWithDropdownIcon.xaml:
<AbsoluteLayout xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:svg="clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms"
x:Class="CollateralUploader.XAMLHelpers.PickerWithDropdownIcon">
<Picker x:Name="InnerPicker" />
<svg:SvgCachedImage AbsoluteLayout.LayoutBounds="1,0.5,-1,-1" AbsoluteLayout.LayoutFlags="PositionProportional"
Source="resource://CollateralUploader.Images.icon-down_arrow.svg">
<svg:SvgCachedImage.GestureRecognizers>
<TapGestureRecognizer Tapped="PickerArrow_Tapped" />
</svg:SvgCachedImage.GestureRecognizers>
</svg:SvgCachedImage>
</AbsoluteLayout>
在我的View
中,我想做这样的事情:
<xh:PickerWithDropdownIcon>
<InnerPicker.SelectedItem="{Binding VehicleNumberText}" />
<InnerPicker.Items>
<x:String>Vehicle 1</x:String>
<x:String>Vehicle 2</x:String>
</Picker.Items>
</xh:PickerWithDropdownIcon>
有可能做这样的事情吗?