重构中day1,写了很多,不知道怎么说清楚

This commit is contained in:
fengjiayi
2025-03-18 21:01:15 +08:00
parent 87402ec7ea
commit 2168c5ec66
39 changed files with 2809 additions and 10 deletions

View File

@@ -0,0 +1,29 @@
<UserControl x:Class="Serein.Workbench.Customs.FlowMethodInfoListBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:converter="clr-namespace:Serein.Workbench.Converters"
xmlns:local="clr-namespace:Serein.Workbench.Customs"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<converter:CountToVisibilityConverter x:Key="CountToVisibilityConverter"/>
</UserControl.Resources>
<ListBox ItemsSource="{Binding Nodes}"
Visibility="{Binding Nodes, Converter={StaticResource CountToVisibilityConverter}}"
Background="{Binding BackgroundColor}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Margin="2">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding NodeType}"></TextBlock>
<TextBlock Text="{Binding AnotherName}" Margin="4,0,0,0"></TextBlock>
<TextBlock Text="{Binding MethodName}" Margin="6,0,0,0"></TextBlock>
</StackPanel>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</UserControl>

View File

@@ -0,0 +1,100 @@
using Serein.Library;
using Serein.Workbench.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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.Navigation;
using System.Windows.Shapes;
namespace Serein.Workbench.Customs
{
public class Test: DependencyObject
{
}
/// <summary>
/// FlowMethodInfoListBox.xaml 的交互逻辑
/// </summary>
public partial class FlowMethodInfoListBox : UserControl
{
public FlowMethodInfoListBox()
{
this.DataContext = this;
InitializeComponent();
}
public IEnumerable<FlowLibraryMethodDetailsInfo> Nodes
{
get { return (IEnumerable<FlowLibraryMethodDetailsInfo>)GetValue(NodesProperty); }
set { SetValue(NodesProperty, value); }
}
//public ItemCollection Items
//{
// get
// {
// return (ItemCollection)GetValue(ItemsProperty);
// }
// set
// {
// SetValue(ItemsProperty, value);
// }
//}
public static readonly DependencyProperty NodesProperty = DependencyProperty.Register("NodesProperty", typeof(IEnumerable<FlowLibraryMethodDetailsInfo>), typeof(FlowMethodInfoListBox));
//public int TurnValue
//{
// get
// {
// return (int)GetValue(TurnValueProperty);
// }
// set
// {
// SetValue(TurnValueProperty, value);
// }
//}
// public static readonly DependencyProperty NodesProperty = DependencyProperty.Register(nameof(Nodes), typeof(IEnumerable<FlowLibraryMethodDetailsInfo>), typeof(FlowMethodInfoListBox), new PropertyMetadata(null));
public Brush BackgroundColor
{
get { return (Brush)GetValue(BackgroundColorProperty); }
set { SetValue(BackgroundColorProperty, value); }
}
public static readonly DependencyProperty BackgroundColorProperty =
DependencyProperty.Register(nameof(BackgroundColor), typeof(Brush), typeof(FlowMethodInfoListBox), new PropertyMetadata(Brushes.White));
}
}