mirror of
https://github.com/jackqqq123/luban_ui_internal.git
synced 2025-11-15 13:48:24 +08:00
116 lines
7.0 KiB
Plaintext
116 lines
7.0 KiB
Plaintext
|
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||
|
|
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:views="clr-namespace:LubanHub.App.Views"
|
||
|
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||
|
|
x:Class="LubanHub.App.Views.ConfigurationView">
|
||
|
|
<Grid>
|
||
|
|
<ScrollViewer>
|
||
|
|
<StackPanel Margin="20">
|
||
|
|
<TextBlock Text="配置管理" FontSize="24" FontWeight="Bold" Margin="0,0,0,20"/>
|
||
|
|
|
||
|
|
<!-- 配置分组列表 -->
|
||
|
|
<ItemsControl ItemsSource="{Binding ConfigurationGroups}">
|
||
|
|
<ItemsControl.ItemTemplate>
|
||
|
|
<DataTemplate>
|
||
|
|
<Expander Header="{Binding DisplayName}" IsExpanded="True" Margin="0,0,0,10">
|
||
|
|
<Expander.HeaderTemplate>
|
||
|
|
<DataTemplate>
|
||
|
|
<StackPanel Orientation="Horizontal">
|
||
|
|
<TextBlock Text="{Binding Icon}" FontSize="16" Margin="0,0,8,0"
|
||
|
|
IsVisible="{Binding Icon, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||
|
|
<TextBlock Text="{Binding DisplayName}" FontWeight="SemiBold"/>
|
||
|
|
<TextBlock Text="{Binding Description}" FontSize="12" Opacity="0.7" Margin="8,0,0,0"
|
||
|
|
IsVisible="{Binding Description, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||
|
|
</StackPanel>
|
||
|
|
</DataTemplate>
|
||
|
|
</Expander.HeaderTemplate>
|
||
|
|
|
||
|
|
<Border Background="#F5F5F5" Padding="15" Margin="5">
|
||
|
|
<ItemsControl ItemsSource="{Binding Properties}">
|
||
|
|
<ItemsControl.ItemTemplate>
|
||
|
|
<DataTemplate>
|
||
|
|
<StackPanel Margin="0,0,0,15">
|
||
|
|
<TextBlock Text="{Binding DisplayName}" FontWeight="SemiBold" Margin="0,0,0,5"/>
|
||
|
|
<TextBlock Text="{Binding Description}" FontSize="12" Opacity="0.7" Margin="0,0,0,5"
|
||
|
|
IsVisible="{Binding Description, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||
|
|
|
||
|
|
<!-- 根据InputType显示不同的控件 -->
|
||
|
|
<ContentControl>
|
||
|
|
<ContentControl.ContentTemplate>
|
||
|
|
<DataTemplate>
|
||
|
|
<Panel>
|
||
|
|
<!-- TextBox -->
|
||
|
|
<TextBox Text="{Binding Value}"
|
||
|
|
Watermark="{Binding Placeholder}"
|
||
|
|
IsVisible="{Binding InputType, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=TextBox}"/>
|
||
|
|
|
||
|
|
<!-- PasswordBox -->
|
||
|
|
<TextBox Text="{Binding Value}"
|
||
|
|
PasswordChar="*"
|
||
|
|
Watermark="{Binding Placeholder}"
|
||
|
|
IsVisible="{Binding InputType, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=PasswordBox}"/>
|
||
|
|
|
||
|
|
<!-- NumberBox -->
|
||
|
|
<NumericUpDown Value="{Binding Value}"
|
||
|
|
IsVisible="{Binding InputType, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=NumberBox}"/>
|
||
|
|
|
||
|
|
<!-- CheckBox -->
|
||
|
|
<CheckBox IsChecked="{Binding Value}"
|
||
|
|
Content="{Binding DisplayName}"
|
||
|
|
IsVisible="{Binding InputType, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=CheckBox}"/>
|
||
|
|
|
||
|
|
<!-- TextArea -->
|
||
|
|
<TextBox Text="{Binding Value}"
|
||
|
|
AcceptsReturn="True"
|
||
|
|
Height="100"
|
||
|
|
Watermark="{Binding Placeholder}"
|
||
|
|
IsVisible="{Binding InputType, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=TextArea}"/>
|
||
|
|
|
||
|
|
<!-- FilePicker / DirectoryPicker / UrlBox 等其他类型暂时用TextBox代替 -->
|
||
|
|
<StackPanel Orientation="Horizontal"
|
||
|
|
IsVisible="{Binding InputType, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=DirectoryPicker}">
|
||
|
|
<TextBox Text="{Binding Value}"
|
||
|
|
Watermark="{Binding Placeholder}"
|
||
|
|
Width="300"/>
|
||
|
|
<Button Content="浏览..." Margin="5,0,0,0"/>
|
||
|
|
</StackPanel>
|
||
|
|
|
||
|
|
<StackPanel Orientation="Horizontal"
|
||
|
|
IsVisible="{Binding InputType, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=FilePicker}">
|
||
|
|
<TextBox Text="{Binding Value}"
|
||
|
|
Watermark="{Binding Placeholder}"
|
||
|
|
Width="300"/>
|
||
|
|
<Button Content="选择..." Margin="5,0,0,0"/>
|
||
|
|
</StackPanel>
|
||
|
|
</Panel>
|
||
|
|
</DataTemplate>
|
||
|
|
</ContentControl.ContentTemplate>
|
||
|
|
</ContentControl>
|
||
|
|
|
||
|
|
<!-- 验证错误提示 -->
|
||
|
|
<TextBlock Text="{Binding ValidationMessage}"
|
||
|
|
Foreground="Red"
|
||
|
|
FontSize="11"
|
||
|
|
Margin="0,3,0,0"
|
||
|
|
IsVisible="{Binding HasValidationError}"/>
|
||
|
|
</StackPanel>
|
||
|
|
</DataTemplate>
|
||
|
|
</ItemsControl.ItemTemplate>
|
||
|
|
</ItemsControl>
|
||
|
|
</Border>
|
||
|
|
</Expander>
|
||
|
|
</DataTemplate>
|
||
|
|
</ItemsControl.ItemTemplate>
|
||
|
|
</ItemsControl>
|
||
|
|
|
||
|
|
<!-- 保存按钮 -->
|
||
|
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,20,0,0">
|
||
|
|
<Button Content="重置" Margin="0,0,10,0" x:Name="ResetButton"/>
|
||
|
|
<Button Content="保存配置" x:Name="SaveButton"/>
|
||
|
|
</StackPanel>
|
||
|
|
</StackPanel>
|
||
|
|
</ScrollViewer>
|
||
|
|
</Grid>
|
||
|
|
</UserControl>
|