我找不到任何有关如何在毛伊岛实现推送通知的文档。也许有人能够将 xamarin 库集成到 maui 项目中来完成它?
我正在完全使用 Blazor 构建我的应用程序。一切都发生在我的 BlazorWebView 内。是否可以RefreshView在 .razor 文件中使用类似内容?我知道我可以ContentView从代码后面实例化 a 但我可以将它实现到页面中吗?
.Host.ConfigureAppConfiguration我为 MAUI 应用程序创建了一个 appsettings 文件,并使用MauiApp.CreateBuilder(); 的构建器将其加载到 IConfiguration 中;我可以在 Windows 中访问该文件,但在运行 Android 模拟器时则无法访问。代码:
var builder = MauiApp.CreateBuilder();
builder
.RegisterBlazorMauiWebView()
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
})
.Host
.ConfigureAppConfiguration((app, config) =>
{
#if __ANDROID__
// /sf/ask/3490731191/
//var documentsFolderPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
config.AddJsonFile( "appsettings.json", optional: false, reloadOnChange: true);
#endif
#if WINDOWS10_0_17763_0_OR_GREATER
///sf/ask/4830033211/
Assembly callingAssembly = Assembly.GetEntryAssembly();
Version versionRuntime = callingAssembly.GetName().Version;
string assemblyLocation = Path.GetDirectoryName(System.AppContext.BaseDirectory); //CallingAssembly.Location
var configFile = Path.Combine(assemblyLocation, "appsettings.json");
config.AddJsonFile(configFile, optional: false, reloadOnChange: true);
#endif
});
Run Code Online (Sandbox Code Playgroud)
样机项目在这里
我正在尝试编写一个程序,该程序将用作另一个程序之上的覆盖。我希望文本、按钮和边框是实心的,背景是透明的。
<VerticalStackLayout Spacing="25" Padding="30" BackgroundColor="Transparent" IsVisible="True" Opacity="1">
Run Code Online (Sandbox Code Playgroud)
这适用于其中一层,但似乎有多个层。
这里 提到更改ContentPage,我尝试过,但似乎不起作用。
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="NameSpace.MainPage"
xmlns:local="clr-namespace:NameSpace"
BackgroundColor="Transparent">
Run Code Online (Sandbox Code Playgroud)
我也尝试过:
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="NameSpace.MainPage"
xmlns:local="clr-namespace:NameSpace.Core.Views.CustomControls"
BackgroundColor="Transparent">
Run Code Online (Sandbox Code Playgroud)
我将外壳更改为包含透明背景颜色,但这没有帮助。
<Shell
x:Class="NameSpace.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:NameSpace"
Shell.FlyoutBehavior="Disabled"
BackgroundColor="Transparent">
Run Code Online (Sandbox Code Playgroud)
更改 ContentPage 或 Shell 时,似乎没有任何变化。
这些似乎都没有改变 VerticalStackLayout 后面的背景颜色。有任何想法吗?
我在 Blazor Server 应用程序中使用了 Signal-R,但我没有找到在 .NET MAUI 中实现它的方法。显然这个环境还不支持 Signal-R,但我可能是错的。
如果是,如何IHubContext<XHub>在 MauiProgram.cs 中将其声明为服务?
有没有人找到从 Blazor MAUI 混合应用程序扫描二维码的有效解决方案?
我已经找到了许多用于“普通”Blazor 的库(例如 BigIslandBarcoding、ZXing.Net),但没有任何具体内容可以从 razor 页面(在 BlazorWebView 中)在移动设备(iOS 和 Android)上执行此操作。
我正在寻找一个简单的操作来通过单击按钮打开相机读取器/扫描仪,但找不到类似的东西。
MAUI 中有一个可以进行多项选择的选择器吗?我找不到任何。
到目前为止,我使用的是标准的。但它没有选择多个值的能力。
<Picker x:Name="MyPicker" VerticalOptions="Center"></Picker>
Run Code Online (Sandbox Code Playgroud)
在此处的文档中,他们也没有谈论任何多重选择。
我在 .NET MAUI 中使用 ScrollView 创建了下面的代码,当尝试滚动时没有任何反应。任何帮助,将不胜感激。
<ContentPage.Content>
<StackLayout>
<!-- <local:NavigationControl x:Name="_accountPage"/> -->
<ScrollView VerticalScrollBarVisibility="Always">
<StackLayout Margin="5" Spacing="20">
--- some content
</StackLayout>
</ScrollView>
</StackLayout>
</ContentPage.Content>
</ContentPage>
Run Code Online (Sandbox Code Playgroud)
问候,阿里
我在 .Net Maui 有一个开关控件:
<Switch IsToggled="true" Grid.Row="3" Grid.Column="1" VerticalOptions="Center"/>
Run Code Online (Sandbox Code Playgroud)
默认情况下,它根据其状态显示“开/关”标签。我希望它什么也不显示。
有什么方法可以隐藏/删除它吗?
如何使用绑定和 DataTemplate 呈现字符串、数字或视图模型?
我正在寻找 WPF ContentControl 的 MAUI 替代品。
具有ContentViewContent 属性,但这是来自 type View。具有ContentPresenterContent 属性,但这也来自 type View。<Ignorable>WTF,为什么它只能呈现一个视图,而不被命名为 ViewPresenter ???有时 MAUI 很奇怪。</Ignorable>
如何通过为每种数据类型定义数据模板来呈现任何内容?
class PropertyViewModel {
public string Name {get;set;}
public object Value {get;set;}
}
Run Code Online (Sandbox Code Playgroud)
<Page.Resources>
<DataTemplate DataType="System.String">
<Entry Text="{Binding}/>
</DataTemplate>
<DataTemplate DataType="System.Int32">
<NumberPicker Value="{Binding}/>
</DataTemplate>
.. more templates, eg. DatePicker for System.DateOnly
</Page.Resources>
<DockLayout>
<Label Text="{Binding Name}
<TemplatedContenView Content={Binding Value}/>
</DockPanel>
Run Code Online (Sandbox Code Playgroud)
TemplatedContenView 或 ContentControl(MAUI 中不存在)可以对不同类型的值使用不同的模板。在 WPF 中,ContentControl 使用 ContentTemplate、ContentTemplateSelector,或者如果未指定,则它会查找资源来查找模板。
<Ignorable>对于 MAUI,我经常有一种感觉,我必须不断地重新发明 …
maui ×10
.net ×2
blazor ×2
.net-6.0 ×1
asp.net-core ×1
background ×1
c# ×1
maui-blazor ×1
qr-code ×1
scrollview ×1
signalr ×1
transparency ×1