Merge remote-tracking branch 'origin/master'
# Conflicts: # ConsoleApp/ConsoleApp.csproj # ConsoleApp/Program.cs # RvAddinTest/FluentAddin.cs # RvAddinTest/InstancesCreator.cs # RvAddinTest/ReplaceCode.cs # Sai.RvKits.sln # Sai.RvKits/RvView/ElementControlDock.xaml.cs # ShrlAlgo.Addin.Test/AddWallTypeParam.cs # ShrlAlgo.Addin.Test/CreateWindow.xaml.cs # ShrlAlgo.Addin.Test/GASInstancesCreator.cs # ShrlAlgo.Addin.Test/ModifySystemTypeCmd.cs # ShrlAlgo.Addin.Test/ShrlAlgo.Addin.Test.csproj # ShrlAlgo.Addin.Test/TempCmd.cs # ShrlAlgo.RvKits/ModelManager/SeparateModelCmd.cs # ShrlAlgo.RvKits/ModelManager/SeparateModelViewModel.cs # ShrlAlgo.RvKits/ModelManager/SeparateModelWin.xaml # ShrlAlgo.RvKits/ModelManager/SeparateModelWin.xaml.cs # ShrlAlgo.RvKits/Resources/adaptive_MEP_tag_16px.png # ShrlAlgo.RvKits/Resources/adaptive_MEP_tag_32px.png # ShrlAlgo.RvKits/RvView/AdaptiveMEPTagCmd.cs # ShrlAlgo.RvKits/UIRibbon/DrawingViewApp.cs # ShrlAlgo.Toolkit.Mvvm/Converters/InvertBooleanConverter.cs # ShrlAlgo.Toolkit.Revit/Assist/CollectorAssist.cs # ShrlAlgo.Toolkit.Revit/Helpers/KeyboardShortcutService.cs # ShrlAlgo.Toolkit.Revit/Helpers/ParameterAssist.cs # Wpf.Ui.Extend/Wpf.Ui.Extend.csproj # WpfApp/MainViewModel.cs # WpfApp/MainWindow.xaml # WpfApp/WpfApp.csproj
This commit is contained in:
6
WPFUIAPP/App.config
Normal file
6
WPFUIAPP/App.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
19
WPFUIAPP/App.xaml
Normal file
19
WPFUIAPP/App.xaml
Normal file
@@ -0,0 +1,19 @@
|
||||
<Application
|
||||
x:Class="WPFUIAPP.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:WPFUIAPP"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:vio="http://schemas.lepo.co/wpfui/2022/xaml/violeta"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ui:ThemesDictionary Theme="Dark" />
|
||||
<ui:ControlsDictionary />
|
||||
<vio:ThemesDictionary Theme="Dark" />
|
||||
<vio:ControlsDictionary />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
26
WPFUIAPP/App.xaml.cs
Normal file
26
WPFUIAPP/App.xaml.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
using Wpf.Ui.Violeta.Controls;
|
||||
|
||||
namespace WPFUIAPP
|
||||
{
|
||||
/// <summary>
|
||||
/// App.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
public App()
|
||||
{
|
||||
Splash.ShowAsync("pack://application:,,,/Wpf.Ui.Test;component/wpfui.png");
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
131
WPFUIAPP/MainWindow.xaml
Normal file
131
WPFUIAPP/MainWindow.xaml
Normal file
@@ -0,0 +1,131 @@
|
||||
<ui:FluentWindow
|
||||
x:Class="WPFUIAPP.MainWindow"
|
||||
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:local="clr-namespace:WPFUIAPP"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:vio="http://schemas.lepo.co/wpfui/2022/xaml/violeta"
|
||||
Title="MainWindow"
|
||||
Width="800"
|
||||
Height="450"
|
||||
ui:Design.Background="#252525"
|
||||
ui:Design.Foreground="#252525"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<StackPanel>
|
||||
<ui:TitleBar />
|
||||
<ui:Button Click="Button_Click" Content="Toast" />
|
||||
<ui:Button Content="Show Flyout">
|
||||
<ui:FlyoutService.Flyout>
|
||||
<ui:Flyout Placement="Bottom">
|
||||
<StackPanel>
|
||||
<TextBlock HorizontalAlignment="Left" Text="Show the flyout message here" />
|
||||
<Button Command="{Binding GotItCommand}" Content="Got it" />
|
||||
</StackPanel>
|
||||
</ui:Flyout>
|
||||
</ui:FlyoutService.Flyout>
|
||||
</ui:Button>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel.Resources>
|
||||
<vio:ToggleButtonGroup x:Key="ToggleButtonGroup" />
|
||||
</StackPanel.Resources>
|
||||
<ToggleButton
|
||||
vio:ToggleButtonGroup.Group="{DynamicResource ToggleButtonGroup}"
|
||||
Content="1st"
|
||||
IsChecked="True" />
|
||||
<ToggleButton vio:ToggleButtonGroup.Group="{DynamicResource ToggleButtonGroup}" Content="2nd" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel.Resources>
|
||||
<vio:RadioButtonGroup x:Key="RadioButtonGroup" />
|
||||
</StackPanel.Resources>
|
||||
<RadioButton
|
||||
vio:RadioButtonGroup.Group="{DynamicResource RadioButtonGroup}"
|
||||
Content="1st"
|
||||
IsChecked="True" />
|
||||
<Grid>
|
||||
<RadioButton
|
||||
Margin="8,0,0,0"
|
||||
vio:RadioButtonGroup.Group="{DynamicResource RadioButtonGroup}"
|
||||
Content="2nd" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<ui:TreeListView ItemsSource="{Binding StaffList}">
|
||||
<ui:TreeListView.DataContext>
|
||||
<local:ViewModel />
|
||||
</ui:TreeListView.DataContext>
|
||||
<ui:TreeListView.Columns>
|
||||
<GridViewColumnCollection>
|
||||
<ui:GridViewColumn Width="400" Header="Name">
|
||||
<ui:GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ui:TreeRowExpander Content="{Binding Name}" />
|
||||
</DataTemplate>
|
||||
</ui:GridViewColumn.CellTemplate>
|
||||
</ui:GridViewColumn>
|
||||
<ui:GridViewColumn
|
||||
Width="80"
|
||||
DisplayMemberBinding="{Binding Age}"
|
||||
Header="Age" />
|
||||
<ui:GridViewColumn
|
||||
Width="80"
|
||||
DisplayMemberBinding="{Binding Sex}"
|
||||
Header="Sex" />
|
||||
<ui:GridViewColumn
|
||||
Width="100"
|
||||
DisplayMemberBinding="{Binding Duty}"
|
||||
Header="Duty" />
|
||||
<ui:GridViewColumn Width="250" Header="IsChecked">
|
||||
<ui:GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ui:ToggleSwitch IsChecked="{Binding IsChecked}" />
|
||||
</DataTemplate>
|
||||
</ui:GridViewColumn.CellTemplate>
|
||||
</ui:GridViewColumn>
|
||||
</GridViewColumnCollection>
|
||||
</ui:TreeListView.Columns>
|
||||
<ui:TreeListView.ItemTemplate>
|
||||
<HierarchicalDataTemplate ItemsSource="{Binding StaffList}" />
|
||||
</ui:TreeListView.ItemTemplate>
|
||||
</ui:TreeListView>
|
||||
<Button Click="MsgSyncClick" Content="MessageBox" />
|
||||
<Button Click="MsgAsyncClick" Content="MessageBoxAsync" />
|
||||
<Button Click="PendingBoxClick" Content="PendingBox" />
|
||||
<Button Click="ContentDialogClick" Content="ContentDialog" />
|
||||
<Button Click="NewContentDialogClick" Content="NewContentDialog" />
|
||||
<ui:TreeModelListView Model="{Binding TreeTestModel}">
|
||||
<ui:TreeModelListView.DataContext>
|
||||
<local:ViewModel2 />
|
||||
</ui:TreeModelListView.DataContext>
|
||||
<ui:GridView>
|
||||
<ui:GridView.Columns>
|
||||
<ui:GridViewColumn Width="400" Header="Column1">
|
||||
<ui:GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ui:TreeModelRowExpander Content="{Binding Column1}" />
|
||||
</DataTemplate>
|
||||
</ui:GridViewColumn.CellTemplate>
|
||||
</ui:GridViewColumn>
|
||||
<ui:GridViewColumn
|
||||
Width="250"
|
||||
DisplayMemberBinding="{Binding Column2, Mode=TwoWay}"
|
||||
Header="Column2" />
|
||||
<ui:GridViewColumn
|
||||
Width="250"
|
||||
DisplayMemberBinding="{Binding Column3, Mode=TwoWay}"
|
||||
Header="Column3" />
|
||||
<ui:GridViewColumn Width="250" Header="IsChecked">
|
||||
<ui:GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ui:ToggleSwitch IsChecked="{Binding IsChecked}" />
|
||||
</DataTemplate>
|
||||
</ui:GridViewColumn.CellTemplate>
|
||||
</ui:GridViewColumn>
|
||||
</ui:GridView.Columns>
|
||||
</ui:GridView>
|
||||
</ui:TreeModelListView>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ui:FluentWindow>
|
||||
89
WPFUIAPP/MainWindow.xaml.cs
Normal file
89
WPFUIAPP/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
|
||||
using Wpf.Ui.Controls;
|
||||
using Wpf.Ui.Violeta.Controls;
|
||||
|
||||
using MessageBox = Wpf.Ui.Violeta.Controls.MessageBox;
|
||||
|
||||
namespace WPFUIAPP
|
||||
{
|
||||
/// <summary>
|
||||
/// MainWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
Wpf.Ui.Controls.ContentDialog dialog;
|
||||
Wpf.Ui.Violeta.Controls.ContentDialog newdialog;
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
dialog = new()
|
||||
{
|
||||
Title = "My sample dialog",
|
||||
Content = "Content of the dialog",
|
||||
CloseButtonText = "Close button",
|
||||
PrimaryButtonText = "Primary button",
|
||||
SecondaryButtonText = "Secondary button",
|
||||
// Setting the dialog container
|
||||
DialogHost = ContentDialogHostService.ContentPresenterForDialogs
|
||||
};
|
||||
newdialog = new()
|
||||
{
|
||||
Title = "My sample dialog",
|
||||
Content = "Content of the dialog",
|
||||
CloseButtonText = "Close button",
|
||||
PrimaryButtonText = "Primary button",
|
||||
SecondaryButtonText = "Secondary button",
|
||||
DefaultButton = Wpf.Ui.Violeta.Controls.ContentDialogButton.Primary,
|
||||
};
|
||||
Splash.CloseOnLoaded(this, minimumMilliseconds: 1800);
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Toast.Information("I am information message");
|
||||
Toast.Error("I am error message");
|
||||
//Toast.Success("I am success message");
|
||||
//Toast.Warning("I am warning message");
|
||||
//Toast.Show(owner: null, "I am any message", new ToastConfig());
|
||||
}
|
||||
|
||||
private void MsgSyncClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_ = MessageBox.Information("This is a information message");
|
||||
_ = MessageBox.Warning("This is a warning message");
|
||||
_ = MessageBox.Error("This is a error message");
|
||||
var result = MessageBox.Question("This is a question and do you want to click OK?");
|
||||
}
|
||||
|
||||
private async void MsgAsyncClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Async methods
|
||||
_ = await MessageBox.InformationAsync("This is a information message");
|
||||
_ = await MessageBox.WarningAsync("This is a warning message");
|
||||
_ = await MessageBox.ErrorAsync("This is a error message");
|
||||
var result = await MessageBox.QuestionAsync("This is a question and do you want to click OK?");
|
||||
}
|
||||
|
||||
private void PendingBoxClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Default style.
|
||||
using IPendingHandler pending = PendingBox.Show();
|
||||
|
||||
// Show with title and cancel button.
|
||||
//using IPendingHandler pending = PendingBox.Show("Doing something", "I'm a title", isShowCancel: true);
|
||||
|
||||
}
|
||||
|
||||
private async void ContentDialogClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
await dialog.ShowAsync(CancellationToken.None);
|
||||
}
|
||||
|
||||
private async void NewContentDialogClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_ = await dialog.ShowAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
52
WPFUIAPP/Properties/AssemblyInfo.cs
Normal file
52
WPFUIAPP/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("WPFUIAPP")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("WPFUIAPP")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2025")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//若要开始生成可本地化的应用程序,请设置
|
||||
//.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
|
||||
//在 <PropertyGroup> 中。例如,如果你使用的是美国英语。
|
||||
//使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消
|
||||
//对以下 NeutralResourceLanguage 特性的注释。 更新
|
||||
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //主题特定资源词典所处位置
|
||||
//(未在页面中找到资源时使用,
|
||||
//或应用程序资源字典中找到时使用)
|
||||
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
|
||||
//(未在页面中找到资源时使用,
|
||||
//、应用程序或任何主题专用资源字典中找到时使用)
|
||||
)]
|
||||
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
71
WPFUIAPP/Properties/Resources.Designer.cs
generated
Normal file
71
WPFUIAPP/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,71 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本: 4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WPFUIAPP.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 强类型资源类,用于查找本地化字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的缓存 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WPFUIAPP.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写当前线程的 CurrentUICulture 属性,对
|
||||
/// 使用此强类型资源类的所有资源查找执行重写。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
WPFUIAPP/Properties/Resources.resx
Normal file
117
WPFUIAPP/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
30
WPFUIAPP/Properties/Settings.Designer.cs
generated
Normal file
30
WPFUIAPP/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WPFUIAPP.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
WPFUIAPP/Properties/Settings.settings
Normal file
7
WPFUIAPP/Properties/Settings.settings
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
160
WPFUIAPP/ViewModel.cs
Normal file
160
WPFUIAPP/ViewModel.cs
Normal file
@@ -0,0 +1,160 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace WPFUIAPP
|
||||
{
|
||||
public partial class ViewModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<Staff> staffList = [];
|
||||
|
||||
public ViewModel()
|
||||
{
|
||||
InitNode1Value();
|
||||
}
|
||||
public void InitNode1Value()
|
||||
{
|
||||
Staff staff = new Staff()
|
||||
{
|
||||
Name = "Alice",
|
||||
Age = 30,
|
||||
Sex = "Male",
|
||||
Duty = "Manager",
|
||||
IsExpanded = true
|
||||
};
|
||||
Staff staff2 = new Staff()
|
||||
{
|
||||
Name = "Alice1",
|
||||
Age = 21,
|
||||
Sex = "Male",
|
||||
Duty = "Normal",
|
||||
IsExpanded = true
|
||||
};
|
||||
Staff staff3 = new Staff()
|
||||
{
|
||||
Name = "Alice11",
|
||||
Age = 21,
|
||||
Sex = "Male",
|
||||
Duty = "Normal"
|
||||
};
|
||||
staff2.StaffList.Add(staff3);
|
||||
staff3 = new Staff()
|
||||
{
|
||||
Name = "Alice22",
|
||||
Age = 21,
|
||||
Sex = "Female",
|
||||
Duty = "Normal"
|
||||
};
|
||||
staff2.StaffList.Add(staff3);
|
||||
staff.StaffList.Add(staff2);
|
||||
staff2 = new Staff()
|
||||
{
|
||||
Name = "Alice2",
|
||||
Age = 22,
|
||||
Sex = "Female",
|
||||
Duty = "Normal"
|
||||
};
|
||||
staff.StaffList.Add(staff2);
|
||||
staff2 = new Staff()
|
||||
{
|
||||
Name = "Alice3",
|
||||
Age = 23,
|
||||
Sex = "Female",
|
||||
Duty = "Normal"
|
||||
};
|
||||
staff.StaffList.Add(staff2);
|
||||
StaffList.Add(staff);
|
||||
|
||||
staff = new Staff()
|
||||
{
|
||||
Name = "Bob",
|
||||
Age = 31,
|
||||
Sex = "Male",
|
||||
Duty = "CEO"
|
||||
};
|
||||
staff2 = new Staff()
|
||||
{
|
||||
Name = "Bob1",
|
||||
Age = 24,
|
||||
Sex = "Female",
|
||||
Duty = "Normal"
|
||||
};
|
||||
staff.StaffList.Add(staff2);
|
||||
staff2 = new Staff()
|
||||
{
|
||||
Name = "Bob2",
|
||||
Age = 25,
|
||||
Sex = "Female",
|
||||
Duty = "Normal"
|
||||
};
|
||||
staff.StaffList.Add(staff2);
|
||||
staff2 = new Staff()
|
||||
{
|
||||
Name = "Bob3",
|
||||
Age = 26,
|
||||
Sex = "Male",
|
||||
Duty = "Normal"
|
||||
};
|
||||
staff.StaffList.Add(staff2);
|
||||
StaffList.Add(staff);
|
||||
|
||||
staff = new Staff()
|
||||
{
|
||||
Name = "Cyber",
|
||||
Age = 32,
|
||||
Sex = "Female",
|
||||
Duty = "Leader"
|
||||
};
|
||||
staff2 = new Staff()
|
||||
{
|
||||
Name = "Cyber1",
|
||||
Age = 27,
|
||||
Sex = "Female",
|
||||
Duty = "Normal"
|
||||
};
|
||||
staff.StaffList.Add(staff2);
|
||||
staff2 = new Staff()
|
||||
{
|
||||
Name = "Cyber2",
|
||||
Age = 28,
|
||||
Sex = "Female",
|
||||
Duty = "Normal"
|
||||
};
|
||||
staff.StaffList.Add(staff2);
|
||||
StaffList.Add(staff);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Staff : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string? name = null;
|
||||
|
||||
[ObservableProperty]
|
||||
private int age;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? sex = null;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? duty = null;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool isChecked = true;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool isSelected = false;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool isExpanded = false;
|
||||
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<Staff> staffList = [];
|
||||
}
|
||||
}
|
||||
71
WPFUIAPP/ViewModel2.cs
Normal file
71
WPFUIAPP/ViewModel2.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace WPFUIAPP;
|
||||
public partial class ViewModel2 : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private TreeModelCollection<TreeTestModel> treeTestModel = CreateTestModel();
|
||||
|
||||
public static TreeModelCollection<TreeTestModel> CreateTestModel()
|
||||
{
|
||||
return new TreeModelCollection<TreeTestModel>()
|
||||
{
|
||||
Children = new(
|
||||
[
|
||||
new()
|
||||
{
|
||||
Column1 = "Test 1",
|
||||
Column2 = "Test 1",
|
||||
Column3 = "Test 1",
|
||||
Children = new(
|
||||
[
|
||||
new()
|
||||
{
|
||||
Column1 = "Test 1.1",
|
||||
Column2 = "Test 1.1",
|
||||
Column3 = "Test 1.1",
|
||||
Children = new(
|
||||
[
|
||||
new()
|
||||
{
|
||||
Column1 = "Test 1.2",
|
||||
Column2 = "Test 1.2",
|
||||
Column3 = "Test 1.2",
|
||||
},
|
||||
]),
|
||||
},
|
||||
]),
|
||||
},
|
||||
new()
|
||||
{
|
||||
Column1 = "Test 2",
|
||||
Column2 = "Test 2",
|
||||
Column3 = "Test 2",
|
||||
}
|
||||
]),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[ObservableObject]
|
||||
public partial class TreeTestModel : TreeModelObject<TreeTestModel>
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string? column1;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? column2;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? column3;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool isChecked = false;
|
||||
}
|
||||
18
WPFUIAPP/WPFUIAPP.csproj
Normal file
18
WPFUIAPP/WPFUIAPP.csproj
Normal file
@@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<UseWPF>true</UseWPF>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>13.0</LangVersion>
|
||||
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
|
||||
<Configurations>All;Debug One;Debug;DefaultBuild;Release</Configurations>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
||||
<PackageReference Include="WPF-UI.Violeta" Version="3.0.5.28" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user