简而言之,我有一个内容视图,例如;
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="myapp.customstacklayout">
<StackLayout>
<StackLayout>
<StackLayout x:Name="header">
<!-- some title things here, such as a header label etc-->
</StackLayout>
<StackLayout x:Name="content">
<!--Contents should be added here when reused-->
</StackLayout>
<StackLayout x:Name="footer">
<!-- some footer things here, such as a summary label etc-->
</StackLayout>
</StackLayout>
<!--Not here-->
</StackLayout>
</ContentView>
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"
xmlns:mycontrols="clr-namespace:myapp"
x:Class="myapp.mainpage">
<StackLayout>
<mycontrols:customstacklayout>
<Button Text="TestButton"/>
<Entry Text="TestEntry"/>
<Label Text="TestLabel"/>
.... and etc..
</mycontrols:customstacklayout>
</StackLayout>
</ContentPage>
Run Code Online (Sandbox Code Playgroud)
要创建这样一个可重用的项目,我认为,在 xaml 中,必须有一些内容让 contentview 指出应该将子项添加到哪个 IView 项目中
有什么想法或一段代码吗? …
我的情况是;
我正在设计一个插件应用程序,基于动态加载插件程序集,多个用户可以运行托管在服务器机器上的应用程序。应用程序在启动时从我的实时更新服务器自动更新插件程序集。所以插件文件(及其附属 dll 不应该被锁定在文件系统上。
byte[] assemblyBytes = File.ReadAllBytes("asm-path");
var assembly = Assembly.Load(assemblyBytes);
Run Code Online (Sandbox Code Playgroud)
正如预期的那样没有锁定 dll 文件。但是如果我正在加载的 dll 本身具有静态引用 dll 呢?他们现在被锁定在文件系统上。
命名文件,让我们说;
PL1_S 和 PL_COMMON 也不应该像 PL1 和 PL2 程序集那样被锁定在文件中
关于如何解决这个问题的任何想法?