2
我想设置一个像这样的背景图像。设置Picker的背景图像
这是我的选择器的背景:
我试图用这个代码:
<Grid >
<Image Source="input_mobile_code_brown.png" x:Name="img"></Image>
<Picker></Picker>
</Grid>
但它首先显示出采收后,像堆布局方向上的图像水平。
我想设置一个像这样的背景图像。设置Picker的背景图像
这是我的选择器的背景:
我试图用这个代码:
<Grid >
<Image Source="input_mobile_code_brown.png" x:Name="img"></Image>
<Picker></Picker>
</Grid>
但它首先显示出采收后,像堆布局方向上的图像水平。
您可以使用RelativeLayout来找到您的控件。我为你写了一个例子,你可以编辑RelativeLayout来适应你的场景。
<RelativeLayout Margin="0,20,0,0">
<Image Source="pickerbackgroundimage.png" Aspect="AspectFit" x:Name="img"
RelativeLayout.XConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=Width,
Factor=0,
Constant=0}"
RelativeLayout.YConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=Height,
Factor=0,
Constant=0}"
/>
<Picker BackgroundColor="Transparent" x:Name="picker"
RelativeLayout.XConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=Width,
Factor=0,
Constant=0}"
RelativeLayout.YConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=Height,
Factor=0,
Constant=0}"
RelativeLayout.WidthConstraint =
"{ConstraintExpression Type=RelativeToView,
ElementName=img,
Property=Width,
Factor=1,
Constant=0}"
RelativeLayout.HeightConstraint =
"{ConstraintExpression Type=RelativeToView,
ElementName=img,
Property=Height,
Factor=1,
Constant=0}"
/>
</RelativeLayout>
由于它的工作原理:) –