










初看,需要继续
安卓不支持KeyValuePair<>的json反序列化
2026.3.24
Current!.On<Microsoft.Maui.Controls.PlatformConfiguration.Android>()
.UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);
.UseMauiCommunityToolkit(options =>
{
options.SetShouldEnableSnackbarOnWindows(true);
})
2026.3.21
2026.2.22
今天有点2的,安卓错误 这可能是由于项目的文件名或路径中包含非 ASCII 字符,就是不能由中文字符等等等等
2026.2.10
public static Page CurrentPage { get => Application.Current!.Windows[0].Page!; }
public static INavigation Navigation { get => CurrentPage.Navigation; }
public static IViewHandler Handler { get => CurrentPage.Handler!; }
故UI相关的类库都需要此属性。
<PropertyGroup>
<MauiXamlInflator>SourceGen</MauiXamlInflator>
</PropertyGroup>
好吧,增加了上面的代码还是无法解决DataTemplateSelector的问题。
问了deepseek,deepseek答对了,原因是动态加载的程序集和主程序集不在同一个 AssemblyLoadContext 中,导致类型解析失败。
AssemblyLoadContext.Default.Load...
** 2026.2.1 **
<?xml version="1.0" encoding="utf-8" ?>
<!--增加x:Name...-->
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Name="TitleView"
xmlns:viewmodels="clr-namespace:MauiSsm"
x:Class="MauiSsm.UI.Default.VTitle">
<CollectionView ItemsSource="{Binding Pages}">
<CollectionView.ItemsLayout>
<LinearItemsLayout Orientation="Horizontal" />
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="x:String">
<Button Text="{Binding}" Margin="0,0,10,0"
Command="{Binding Source={x:Reference TitleView},Path=BindingContext.ExeCommand}"
CommandParameter="{Binding}"></Button>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</ContentView>
<Label
Text="{Binding InitMessage}"
VerticalOptions="Center"
HorizontalOptions="Center" >
<Label.GestureRecognizers>
<TapGestureRecognizer NumberOfTapsRequired="1" Command="{Binding AlertCommand}"></TapGestureRecognizer>
</Label.GestureRecognizers>
</Label>
int i=0;
if(i==1 || i==10 || i==15)
{
}
if(i is (1 or 10 or 15)
if(i!=1 && i!=10 && i!=15)
{
}
if(i is not (1 or 10 or 15)
{
}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。