fix layout of android
parent
22eed0183e
commit
a02aeca6df
|
@ -9,7 +9,7 @@
|
|||
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
|
||||
<AndroidPackageFormat>apk</AndroidPackageFormat>
|
||||
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
|
||||
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
||||
<!-- <EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>-->
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
xmlns:local="using:Notes"
|
||||
x:Class="Notes.App"
|
||||
RequestedThemeVariant="Default">
|
||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||
|
||||
<Application.Styles>
|
||||
<FluentTheme />
|
||||
|
|
|
@ -5,24 +5,26 @@ using Notes.Models;
|
|||
|
||||
namespace Notes.ViewModels;
|
||||
|
||||
public partial class NoteViewModel:ViewModelBase
|
||||
public partial class NoteViewModel : ViewModelBase
|
||||
{
|
||||
private readonly IServices _services;
|
||||
|
||||
[ObservableProperty]
|
||||
private AllNotesViewModel _allNotesViewModel;
|
||||
[ObservableProperty] private AllNotesViewModel _allNotesViewModel;
|
||||
|
||||
[ObservableProperty]
|
||||
private Note _note;
|
||||
[ObservableProperty] private Note _note;
|
||||
|
||||
[Obsolete("Used by designer",true)]
|
||||
#pragma warning disable CS8618
|
||||
public NoteViewModel():base()
|
||||
[ObservableProperty] private bool _isEditingTitle;
|
||||
[ObservableProperty] private bool _isEditingText;
|
||||
[ObservableProperty] private string _editButtonText = "编辑";
|
||||
|
||||
[Obsolete("Used by designer", true)]
|
||||
#pragma warning disable CS8618
|
||||
public NoteViewModel() : base()
|
||||
#pragma warning restore CS8618
|
||||
{
|
||||
|
||||
}
|
||||
public NoteViewModel(IServices services,AllNotesViewModel allNotesViewModel, Note note)
|
||||
|
||||
public NoteViewModel(IServices services, AllNotesViewModel allNotesViewModel, Note note)
|
||||
{
|
||||
this._note = note;
|
||||
this._allNotesViewModel = allNotesViewModel;
|
||||
|
@ -35,6 +37,7 @@ public partial class NoteViewModel:ViewModelBase
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var newName = $"{iptTitleText}{Models.Note.Extension}";
|
||||
Models.Note note = _note;
|
||||
note.Filename = newName;
|
||||
|
@ -45,6 +48,7 @@ public partial class NoteViewModel:ViewModelBase
|
|||
AllNotesViewModel.AddNote(this);
|
||||
// this.OnPropertyChanged(nameof(AllNotesViewModel.NoteViewModels));
|
||||
}
|
||||
|
||||
public void Back()
|
||||
{
|
||||
_services.GetAs<MainViewModel>().Navitation<AllNotesViewModel>(this._services);
|
||||
|
@ -53,7 +57,28 @@ public partial class NoteViewModel:ViewModelBase
|
|||
[RelayCommand]
|
||||
public void OpenNote()
|
||||
{
|
||||
this._services.GetAs<MainViewModel>().Navitation<NoteViewModel>(this._services,this.AllNotesViewModel, this.Note);
|
||||
this._services.GetAs<MainViewModel>().Navitation<NoteViewModel>(this._services, this.AllNotesViewModel, this.Note);
|
||||
}
|
||||
|
||||
|
||||
[RelayCommand]
|
||||
public void ChangeTitle()
|
||||
{
|
||||
IsEditingTitle ^= true;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void ChangeEditTextState()
|
||||
{
|
||||
IsEditingText ^= true;
|
||||
if (IsEditingText)
|
||||
{
|
||||
EditButtonText = "完成";
|
||||
}
|
||||
else
|
||||
{
|
||||
EditButtonText = "编辑";
|
||||
}
|
||||
}
|
||||
|
||||
public void NewNote()
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewModels="clr-namespace:Notes.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
mc:Ignorable="d" d:DesignWidth="720" d:DesignHeight="1280"
|
||||
x:Class="Notes.Views.AboutView"
|
||||
x:CompileBindings="False"
|
||||
>
|
||||
|
@ -11,12 +11,15 @@
|
|||
<viewModels:AboutViewModel/>
|
||||
</Design.DataContext>
|
||||
|
||||
<StackPanel Spacing="10" Margin="10">
|
||||
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||
<DockPanel Margin="10">
|
||||
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Spacing="10">
|
||||
<Label FontSize="22" FontWeight="Bold" Content="{Binding Title}" />
|
||||
<Label FontSize="22" Content="{Binding Version}" />
|
||||
</StackPanel>
|
||||
<Label Content="{Binding Message}" />
|
||||
<Button Content="开始使用" Command="{Binding ShowAllNotesCommand}" />
|
||||
</StackPanel>
|
||||
<Label DockPanel.Dock="Top" Content="{Binding Message}" />
|
||||
<Button DockPanel.Dock="Bottom"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Content="开始使用" Command="{Binding ShowAllNotesCommand}" />
|
||||
</DockPanel>
|
||||
</UserControl>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewModels="clr-namespace:Notes.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
mc:Ignorable="d" d:DesignWidth="720" d:DesignHeight="1280"
|
||||
x:CompileBindings="True"
|
||||
x:Class="Notes.Views.AllNotesView"
|
||||
x:DataType="viewModels:AllNotesViewModel"
|
||||
|
|
|
@ -2,7 +2,17 @@
|
|||
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:viewModels="clr-namespace:Notes.ViewModels"
|
||||
xmlns:notes="clr-namespace:Notes"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Notes.Views.MainView">
|
||||
Welcome to Avalonia!111
|
||||
x:Class="Notes.Views.MainView"
|
||||
x:DataType="viewModels:MainViewModel">
|
||||
<Design.DataContext>
|
||||
<viewModels:MainViewModel/>
|
||||
</Design.DataContext>
|
||||
<ContentControl Content="{Binding ContentViewModel}">
|
||||
<ContentControl.ContentTemplate>
|
||||
<notes:ViewSelector Services="{Binding Service,DataType=viewModels:MainViewModel}" />
|
||||
</ContentControl.ContentTemplate>
|
||||
</ContentControl>
|
||||
</UserControl>
|
||||
|
|
|
@ -11,12 +11,5 @@
|
|||
x:DataType="viewModels:MainViewModel"
|
||||
Title="MainWindowView">
|
||||
|
||||
<Design.DataContext>
|
||||
<viewModels:MainViewModel/>
|
||||
</Design.DataContext>
|
||||
<ContentControl Content="{Binding ContentViewModel}">
|
||||
<ContentControl.ContentTemplate>
|
||||
<notes:ViewSelector Services="{Binding Service,DataType=viewModels:MainViewModel}" />
|
||||
</ContentControl.ContentTemplate>
|
||||
</ContentControl>
|
||||
<views:MainView/>
|
||||
</Window>
|
|
@ -3,10 +3,9 @@
|
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewModels="clr-namespace:Notes.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
mc:Ignorable="d" d:DesignWidth="360" d:DesignHeight="640"
|
||||
x:Class="Notes.Views.NoteView"
|
||||
x:DataType="viewModels:NoteViewModel"
|
||||
>
|
||||
x:DataType="viewModels:NoteViewModel">
|
||||
|
||||
<Design.DataContext>
|
||||
<viewModels:NoteViewModel />
|
||||
|
@ -19,68 +18,82 @@
|
|||
<Setter Property="Background" Value="#c0edc0"></Setter>
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
<Grid ColumnDefinitions="*,2,8*">
|
||||
<ListBox
|
||||
Grid.Column="0"
|
||||
BorderThickness="1"
|
||||
BorderBrush="Black"
|
||||
Background="Bisque"
|
||||
ItemsSource="{Binding AllNotesViewModel.NoteViewModels}"
|
||||
SelectionChanged="SelectingItemsControl_OnSelectionChanged"
|
||||
>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Note.ShortName}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<GridSplitter Grid.Column="1" ResizeDirection="Auto"></GridSplitter>
|
||||
<Border Grid.Column="2" BorderThickness="1" BorderBrush="Black" Background="#559978">
|
||||
<DockPanel>
|
||||
<DockPanel Height="28" DockPanel.Dock="Top">
|
||||
<TextBox
|
||||
Name="iptTitle"
|
||||
Text="{Binding Note.ShortName}"
|
||||
FontSize="20" Padding="5,2" MinHeight="28"
|
||||
Watermark="请输入标题"
|
||||
/>
|
||||
</DockPanel>
|
||||
<DockPanel>
|
||||
|
||||
<Grid ColumnDefinitions="*,2,8*">
|
||||
<ListBox
|
||||
Grid.Column="0"
|
||||
BorderThickness="1"
|
||||
BorderBrush="Black"
|
||||
Background="Bisque"
|
||||
ItemsSource="{Binding AllNotesViewModel.NoteViewModels}"
|
||||
SelectionChanged="SelectingItemsControl_OnSelectionChanged">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Note.ShortName}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<GridSplitter Grid.Column="1" ResizeDirection="Auto"></GridSplitter>
|
||||
<Border Grid.Column="2" BorderThickness="1" BorderBrush="Black" Background="#559978">
|
||||
<DockPanel>
|
||||
<StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom">
|
||||
<Button Name="btnSave"
|
||||
MinHeight="24"
|
||||
Height="24"
|
||||
FontSize="14"
|
||||
Margin="3"
|
||||
Padding="8,2,8,2"
|
||||
>
|
||||
保存
|
||||
</Button>
|
||||
<Button Name="btnBack"
|
||||
MinHeight="24"
|
||||
Height="24"
|
||||
FontSize="14"
|
||||
Margin="3"
|
||||
Padding="8,2,8,2">
|
||||
返回
|
||||
</Button>
|
||||
<Button Name="btnNew"
|
||||
MinHeight="24"
|
||||
Height="24"
|
||||
FontSize="14"
|
||||
Margin="3"
|
||||
Padding="8,2,8,2"
|
||||
>
|
||||
新建
|
||||
</Button>
|
||||
<DockPanel Height="28" DockPanel.Dock="Top">
|
||||
<Button Command="{Binding ChangeTitleCommand}" DockPanel.Dock="Right">修改</Button>
|
||||
<TextBox
|
||||
Name="iptTitle"
|
||||
IsHitTestVisible="{Binding IsEditingTitle}"
|
||||
Text="{Binding Note.ShortName}"
|
||||
FontSize="20" Padding="5,2" MinHeight="28"
|
||||
Watermark="请输入标题" />
|
||||
</DockPanel>
|
||||
<DockPanel>
|
||||
<StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom">
|
||||
<Button Name="btnEdit"
|
||||
MinHeight="24"
|
||||
Height="24"
|
||||
FontSize="14"
|
||||
Margin="3"
|
||||
Padding="8,2,8,2"
|
||||
Command="{Binding ChangeEditTextStateCommand}"
|
||||
Content="{Binding EditButtonText}"
|
||||
>
|
||||
</Button>
|
||||
<Button Name="btnSave"
|
||||
MinHeight="24"
|
||||
Height="24"
|
||||
FontSize="14"
|
||||
Margin="3"
|
||||
Padding="8,2,8,2">
|
||||
保存
|
||||
</Button>
|
||||
<Button Name="btnBack"
|
||||
MinHeight="24"
|
||||
Height="24"
|
||||
FontSize="14"
|
||||
Margin="3"
|
||||
Padding="8,2,8,2">
|
||||
返回
|
||||
</Button>
|
||||
<Button Name="btnNew"
|
||||
MinHeight="24"
|
||||
Height="24"
|
||||
FontSize="14"
|
||||
Margin="3"
|
||||
Padding="8,2,8,2">
|
||||
新建
|
||||
</Button>
|
||||
|
||||
</StackPanel>
|
||||
<TextBox Name="iptContent" Text="{Binding Note.Text}"></TextBox>
|
||||
</StackPanel>
|
||||
<TextBox
|
||||
Name="iptContent"
|
||||
Text="{Binding Note.Text}"
|
||||
IsHitTestVisible="{Binding IsEditingText}"
|
||||
/>
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</UserControl>
|
Loading…
Reference in New Issue