feat: 初始化NewLife Studio项目,完成基础框架与数据管理模块
何炳宏 authored at 2026-05-26 12:09:09
1.72 KiB
NewLife.Studio
<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             x:Class="NewLife.Studio.Modules.DataStudio.Views.ConnectionListView"
             MaxHeight="200">
    <Border BorderBrush="#E0E0E0" BorderThickness="1" Padding="4" CornerRadius="4">
        <Grid RowDefinitions="Auto,*">
            <StackPanel Grid.Row="0" Orientation="Horizontal" Spacing="4" Margin="0,0,0,4">
                <Button Content="+ 新建" Command="{Binding AddConnectionCommand}" Width="60" />
                <Button Content="测试" Command="{Binding TestConnectionCommand}" Width="50" />
                <Button Content="编辑" Command="{Binding EditConnectionCommand}" Width="50" />
                <Button Content="删除" Command="{Binding DeleteConnectionCommand}" Width="50" />
                <Button Content="打开" Command="{Binding OpenConnectionCommand}" Width="50" />
            </StackPanel>
            <ListBox Grid.Row="1" ItemsSource="{Binding Connections}"
                     SelectedItem="{Binding SelectedConnection}"
                     ScrollViewer.VerticalScrollBarVisibility="Auto">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Vertical" Margin="2">
                            <TextBlock Text="{Binding Name}" FontWeight="SemiBold" />
                            <TextBlock Text="{Binding ConnectionString}" FontSize="10" Foreground="Gray"
                                       TextTrimming="CharacterEllipsis" />
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>
    </Border>
</UserControl>