月更
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
<Window x:Class="SyminViewTest.CanvasTestWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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:local="clr-namespace:SyminViewTest"
|
||||
xmlns:sv="clr-namespace:SyminUI.Controls;assembly=SyminUI"
|
||||
mc:Ignorable="d"
|
||||
Style="{StaticResource Window.Normal}"
|
||||
Title="Canvas Test" Height="450" Width="800">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border ClipToBounds="True">
|
||||
<sv:DraggableCanvas x:Name="dragCanvas" Offset="40,20">
|
||||
<Path sv:DraggableCanvas.LeftAnchor="200"
|
||||
sv:DraggableCanvas.TopAnchor="25"
|
||||
Data="M0,0 C25,0 50,25 75,25"
|
||||
Stroke="Black"
|
||||
StrokeThickness="2"
|
||||
/>
|
||||
<sv:DraggableCanvasItem>
|
||||
<Border Height="100" Width="100" Background="Orange"/>
|
||||
</sv:DraggableCanvasItem>
|
||||
<sv:DraggableCanvasItem
|
||||
sv:DraggableCanvas.TopAnchor="125">
|
||||
<Border Height="100" Width="100" Background="Green"
|
||||
ToolTip="124"/>
|
||||
</sv:DraggableCanvasItem>
|
||||
<sv:DraggableCanvasItem
|
||||
sv:DraggableCanvas.LeftAnchor="125">
|
||||
<sv:NodeView Title="节点视图" x:Name="NodeTest"/>
|
||||
</sv:DraggableCanvasItem>
|
||||
</sv:DraggableCanvas >
|
||||
</Border>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1">
|
||||
<Label x:Name="xLabel" Content="x" Width="120"/>
|
||||
<Label x:Name="yLabel" Content="y" Width="120"/>
|
||||
<Button Content="测试按钮"
|
||||
Click="TestButton_Click"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -1,38 +0,0 @@
|
||||
using SyminUI.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using SyminUI.NodeModel.Presets;
|
||||
|
||||
namespace SyminViewTest
|
||||
{
|
||||
/// <summary>
|
||||
/// CanvasTestWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class CanvasTestWindow : Window
|
||||
{
|
||||
NumberAddNode AddNode { get; set; }
|
||||
public CanvasTestWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
AddNode = new NumberAddNode();
|
||||
NodeTest.NodeItemSource = AddNode;
|
||||
}
|
||||
|
||||
private void TestButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
AddNode.InputNumberA.Value = 1;
|
||||
AddNode.InputNumberB.Value = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<Window x:Class="SyminViewTest.DevelopingWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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:svd="clr-namespace:SyminUI.Controls.Decorations;assembly=SyminUI"
|
||||
xmlns:sva="clr-namespace:SyminUI.Controls.Attach;assembly=SyminUI"
|
||||
xmlns:sve="clr-namespace:SyminUI.Effects;assembly=SyminUI"
|
||||
xmlns:local="clr-namespace:SyminViewTest"
|
||||
xmlns:dm="clr-namespace:SyminViewTest.DataModel"
|
||||
xmlns:svcl="clr-namespace:SyminUI.Convertor.List;assembly=SyminUI"
|
||||
mc:Ignorable="d"
|
||||
Title="Developing" Height="400" Width="600"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Style="{StaticResource Window.Normal}"
|
||||
Background="{StaticResource Background.Window}">
|
||||
<Window.Resources>
|
||||
|
||||
</Window.Resources>
|
||||
|
||||
<StackPanel x:Name="stackMain">
|
||||
<ContentControl x:Name="content1" Height="32"/>
|
||||
<ContentControl x:Name="content2" Height="32"/>
|
||||
<Button Click="Button_Click" Content="切换"/>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
@@ -1,42 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SyminViewTest
|
||||
{
|
||||
/// <summary>
|
||||
/// DevelopingWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DevelopingWindow : Window
|
||||
{
|
||||
public DevelopingWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += DevelopingWindow_Loaded;
|
||||
}
|
||||
|
||||
private void DevelopingWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var text = new TextBlock();
|
||||
text.Text = "123";
|
||||
|
||||
content1.Content = text;
|
||||
content2.Content = text;
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -1,16 +0,0 @@
|
||||
using SyminUI;
|
||||
using SyminUI.Views;
|
||||
using SyminViewTest.Views;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SyminViewTest.ViewRenderers
|
||||
{
|
||||
public class TestViewRenderer : ViewRenderer<TestView>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<Window x:Class="SyminViewTest.ViewTestWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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:local="clr-namespace:SyminViewTest"
|
||||
xmlns:vr ="clr-namespace:SyminViewTest.ViewRenderers"
|
||||
mc:Ignorable="d"
|
||||
Style="{StaticResource Window.Normal}"
|
||||
Title="CSharp UI View" Height="450" Width="450">
|
||||
<vr:TestViewRenderer Grid.Row="1" x:Name="ViewTestControl"/>
|
||||
</Window>
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using SyminUI;
|
||||
|
||||
namespace SyminViewTest
|
||||
{
|
||||
/// <summary>
|
||||
/// ViewTestWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ViewTestWindow : Window
|
||||
{
|
||||
public ViewTestWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
using SyminUI;
|
||||
using SyminUI.Views;
|
||||
//using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace SyminViewTest.Views
|
||||
{
|
||||
public class TestView : ViewProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// 提供视图
|
||||
/// </summary>
|
||||
public override IView Body => MainView;
|
||||
|
||||
//测试可切换控件
|
||||
readonly State<IView> dynamicView = new Label("Label A");
|
||||
readonly State<int> inputNum = 123;
|
||||
|
||||
readonly ObservableCollection<string> textCollection = new()
|
||||
{
|
||||
"1111",
|
||||
"2222",
|
||||
"3333"
|
||||
};
|
||||
|
||||
//主要视图
|
||||
private VStack MainView => new VStack
|
||||
{
|
||||
new HStack
|
||||
{
|
||||
new Label(inputNum),
|
||||
new Button("Change Value Button")
|
||||
.OnClick(() => {
|
||||
Console.WriteLine("Button Pressed!");
|
||||
}),
|
||||
new Button("Close Window").OnClick(() =>
|
||||
{
|
||||
//获取宿主窗口并关闭
|
||||
HostWindow?.Close();
|
||||
}),
|
||||
},
|
||||
new HStack
|
||||
{
|
||||
new Button("Open Canvas")
|
||||
.OnClick(() =>
|
||||
{
|
||||
CanvasTestWindow testWindow = new();
|
||||
testWindow.Show();
|
||||
}),
|
||||
new Label("Label In HStack"),
|
||||
}.HorizontalAlignment(HorizontalAlignment.Center),
|
||||
new Grid()
|
||||
{
|
||||
new ContentView(dynamicView)
|
||||
.GridLayout(0, 0),
|
||||
new Button("Change Content")
|
||||
.OnClick(() => { dynamicView.Value = new Label("Changed View"); })
|
||||
.GridLayout(0, 1),
|
||||
new InputField(inputNum)
|
||||
.GridLayout(1, 0),
|
||||
new Button("Show Input Value")
|
||||
.OnClick(() => MessageBox.Show(inputNum.Value.ToString()))
|
||||
.GridLayout(1, 1),
|
||||
}
|
||||
.Cols("2*", ("*", 200, 400))
|
||||
.Rows("auto", "auto"),
|
||||
new Button("Add List Item")
|
||||
.OnClick(TestCollection),
|
||||
new ItemsView()
|
||||
.Foreach(textCollection, x => new HStack
|
||||
{
|
||||
new Label("List Items"),
|
||||
new Button(x),
|
||||
})
|
||||
};
|
||||
|
||||
private void TestCollection()
|
||||
{
|
||||
textCollection.Insert(1, "Inserted Item");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user