z-index的概念是什么?图为没有重叠.
如何设置z-index?前两个自定义选择框
<AbsoluteLayout Padding="10,10,10,10" VerticalOptions="FillAndExpand">
<ui:BoxSelector x:Name="selectorExchangs"
AbsoluteLayout.LayoutBounds="0,0,0.5,0.3"
AbsoluteLayout.LayoutFlags="All"
BackgroundColor="Transparent"
CommandAfterChanged="{Binding ExchangesAfterChangedCommand}"
Items="{Binding ExchangesList}"
LabelPath="Name"
PanelColor="#f9f9f9"
SelectedItem="{Binding SelectedExchange}"
SelectorLabel="EXCHANGE" />
<ui:BoxSelector AbsoluteLayout.LayoutBounds="1,0,0.5,0.3"
AbsoluteLayout.LayoutFlags="All"
BackgroundColor="Transparent"
CommandAfterChanged="{Binding TradingPairAfterChangedCommand}"
Items="{Binding AvailableTradinPairsList}"
LabelPath="PriceCurrencyName"
PanelColor="#f9f9f9"
SelectedItem="{Binding SelectedTraingPair}"
SelectorLabel="CURRENCY" />
Run Code Online (Sandbox Code Playgroud)
其余的都是.图表,数据等
<StackLayout AbsoluteLayout.LayoutBounds="1,1,1,0.9" AbsoluteLayout.LayoutFlags="All">...</StackLayout>
Run Code Online (Sandbox Code Playgroud)
BoxSelector.xaml(内容视图),可重用的ContentView扩展
<ContentView.Resources>
<ResourceDictionary x:Name="AppDictionary">
<Color x:Key="BackgroundColor">#f9f9f9</Color>
<Color x:Key="BorderColor">#e2e2e2</Color>
<Style x:Key="InternalViewStyle" TargetType="ContentView">
<Setter Property="BackgroundColor" Value="{StaticResource BackgroundColor}" />
<Setter Property="VerticalOptions" Value="Fill" />
<Setter Property="Padding" Value="5,5,5,5" />
</Style>
<Style x:Key="BorderStyle" TargetType="ContentView">
<Setter Property="BackgroundColor" Value="{StaticResource BorderColor}" />
<Setter Property="Padding" Value="1,1,1,1" />
</Style>
</ResourceDictionary>
</ContentView.Resources>
<StackLayout BindingContext="{x:Reference …Run Code Online (Sandbox Code Playgroud) 如何在 .NET MAUI 应用程序中将页面设置为具有线性背景?
我尝试定义LinearGradientBrushin Colors.xaml,然后将其分配为StaticResource- 见下文 - 但这似乎不起作用。
在 中Colors.xaml,我有这个:
<LinearGradientBrush x:Key="PageGradientBackground" EndPoint="1,1">
<GradientStop
Color="{StaticResource UIOffWhite}"
Offset="0.1"/>
<GradientStop
Color="{StaticResource UILightGray}"
Offset="0.6"/>
<GradientStop
Color="{StaticResource UIMidGray}"
Offset="1.0"/>
</LinearGradientBrush>
Run Code Online (Sandbox Code Playgroud)
然后像这样使用它:
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
BackgroundColor="{StaticResource PageGradientBackground}">
<!-- ... -->
</ContentPage>
Run Code Online (Sandbox Code Playgroud)
我也尝试过内联定义它,但这也不起作用。这实际上是不允许的:
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<ContentPage.BackgroundColor>
<LinearGradientBrush>
</LinearGradientBrush>
</ContentPage.BackgroundColor>
<!-- ... -->
</ContentPage>
Run Code Online (Sandbox Code Playgroud)
知道如何为 a 提供渐变背景ContentPage吗?