【发布时间】:2017-07-14 14:36:29
【问题描述】:
要求: 我在特定条件下向用户显示自定义弹出窗口,但我无法使弹出背景变暗,就像显示警报即将到来时它的背景屏幕很暗一样。请提出任何想法。提前致谢。
这里是示例代码:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackLayout Grid.Row = "0" HorizontalOptions = "FillAndExpand" VeticalOptions = "FillAndExpand">
<Label Text = "Sample" />
<Label Text = "Sample" />
<Label Text = "Sample" />
<Label Text = "Sample" />
</StackLayout>
<controls:SampleCustomPopup x:Name="DialACallControl" Grid.Row="0" IsVisible="{Binding IsPopUpToShow}" Grid.RowSpan="2"
VerticalOptions="CenterAndExpand"/>
</Grid>
这里是代码CustomPopup代码:
<StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Padding="7">
<Frame BackgroundColor="White" OutlineColor="#f5f5f5" HasShadow="True">
<StackLayout>
<StackLayout Orientation="Horizontal" HorizontalOptions="CenterAndExpand">
<Image Source="phone.png">
<Image.HeightRequest>
<OnIdiom x:TypeArguments="x:Double">
<OnIdiom.Phone>
<OnPlatform x:TypeArguments="x:Double" iOS="25" Android="30" WinPhone="30" />
</OnIdiom.Phone>
<OnIdiom.Tablet>
<OnPlatform x:TypeArguments="x:Double" iOS="35" Android="40" WinPhone="40" />
</OnIdiom.Tablet>
</OnIdiom>
</Image.HeightRequest>
</Image>
<Label Text="{Binding PhoneNumber}" VerticalTextAlignment="Center" TextColor="#323232" FontFamily="Avenir Book">
<Label.FontSize>
<OnIdiom x:TypeArguments ="x:Double" Phone ="15" Tablet ="20"/>
</Label.FontSize>
</Label>
</StackLayout>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Text="Call" Grid.Column="0" TextColor="White" BorderRadius="0" HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand" BackgroundColor="#f2c646" BorderColor="Black" StyleId="phagspab" >
<Button.FontSize>
<OnIdiom x:TypeArguments ="x:Double" Phone ="15" Tablet ="20"/>
</Button.FontSize>
<Button.HeightRequest>
<OnIdiom x:TypeArguments="x:Double">
<OnIdiom.Phone>
<OnPlatform x:TypeArguments="x:Double" iOS="30" Android="40" WinPhone="30" />
</OnIdiom.Phone>
<OnIdiom.Tablet>
<OnPlatform x:TypeArguments="x:Double" iOS="40" Android="50" WinPhone="40" />
</OnIdiom.Tablet>
</OnIdiom>
</Button.HeightRequest>
</Button>
<Button Text="Cancel" Grid.Column="1" TextColor="White" BorderRadius="0" HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand" BackgroundColor="#323232" BorderColor="Black" StyleId="phagspab" >
<Button.FontSize>
<OnIdiom x:TypeArguments ="x:Double" Phone ="15" Tablet ="20"/>
</Button.FontSize>
<Button.HeightRequest>
<OnIdiom x:TypeArguments="x:Double">
<OnIdiom.Phone>
<OnPlatform x:TypeArguments="x:Double" iOS="30" Android="40" WinPhone="30" />
</OnIdiom.Phone>
<OnIdiom.Tablet>
<OnPlatform x:TypeArguments="x:Double" iOS="40" Android="50" WinPhone="40" />
</OnIdiom.Tablet>
</OnIdiom>
</Button.HeightRequest>
</Button>
</Grid>
</StackLayout>
</Frame>
</StackLayout>
【问题讨论】:
标签: xamarin xamarin.forms