Skip to content

Commit

Permalink
add: 再套一个view,方便以后移植安卓端不会出bug
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxuuu committed Feb 1, 2025
1 parent ed27390 commit 235d34c
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 15 deletions.
12 changes: 12 additions & 0 deletions llcomNext/LLCOM/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LLCOM.ViewModels;

public partial class MainViewModel : ViewModelBase
{

}
6 changes: 0 additions & 6 deletions llcomNext/LLCOM/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ namespace LLCOM.ViewModels

public partial class MainWindowViewModel : ViewModelBase
{
/// <summary>
/// 标题栏
/// </summary>
[ObservableProperty]
public string _title = "LLCOM";

public MainWindowViewModel()
{

Expand Down
18 changes: 18 additions & 0 deletions llcomNext/LLCOM/Views/MainView.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<UserControl
x:Class="LLCOM.Views.MainView"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:LLCOM.ViewModels"
d:DesignHeight="450"
d:DesignWidth="800"
x:DataType="vm:MainViewModel"
mc:Ignorable="d">
<Grid>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="Welcome to Avalonia!" />
</Grid>
</UserControl>
13 changes: 13 additions & 0 deletions llcomNext/LLCOM/Views/MainView.axaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;

namespace LLCOM.Views;

public partial class MainView : UserControl
{
public MainView()
{
InitializeComponent();
}
}
15 changes: 6 additions & 9 deletions llcomNext/LLCOM/Views/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="clr-namespace:LLCOM.Views"
xmlns:vm="using:LLCOM.ViewModels"
Title="{Binding Title}"
d:DesignHeight="450"
d:DesignWidth="800"
Title="LLCOM Next"
Height="800"
Width="1200"
x:DataType="vm:MainWindowViewModel"
Icon="/Assets/llcom-logo.ico"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">

<Design.DataContext>
<vm:MainWindowViewModel />
</Design.DataContext>


<!-- 这里别写别的ui控件,不然跨平台会出问题 -->
<views:MainView />
</Window>

0 comments on commit 235d34c

Please sign in to comment.