chore: update textbox demo.

This commit is contained in:
NaBian committed 2025-04-12 21:24:46 +08:00
1 parent 49ad8c2987
commit 35907e80f1
3 files changed
+233 -35

No files matched your search

@@ -8,42 +8,123 @@
DataContext="{Binding InputElementDemo, Source={StaticResource Locator}}">
<hc:TransitioningContentControl>
<hc:ScrollViewer IsInertiaEnabled="True">
<hc:UniformSpacingPanel Spacing="32" Margin="32" ChildWrapping="Wrap">
<hc:UniformSpacingPanel Spacing="32"
Margin="32"
ChildWrapping="Wrap">
<StackPanel>
<hc:TextBox hc:InfoElement.ShowClearButton="True" Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"/>
<hc:TextBox Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" Margin="0,16,0,0" IsEnabled="False"/>
<hc:TextBox hc:InfoElement.ShowClearButton="True"
Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" />
<hc:TextBox Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"
Margin="0,16,0,0"
IsEnabled="False" />
<hc:TextBox hc:InfoElement.ShowClearButton="True" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr1}}" Margin="0,32,0,0" Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"/>
<hc:TextBox hc:InfoElement.ShowClearButton="True" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr1}}" Margin="0,16,0,0" Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" IsEnabled="False"/>
<hc:TextBox hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterEmail}}" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr2}}" hc:InfoElement.Necessary="True" Margin="0,16,0,0">
<hc:TextBox hc:InfoElement.ShowClearButton="True"
hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr1}}"
Margin="0,32,0,0"
Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" />
<hc:TextBox hc:InfoElement.ShowClearButton="True"
hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr1}}"
Margin="0,16,0,0"
Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"
IsEnabled="False" />
<hc:TextBox hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterEmail}}"
hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr2}}"
hc:InfoElement.Necessary="True"
Margin="0,16,0,0">
<hc:TextBox.Text>
<Binding Path="Email1" UpdateSourceTrigger="PropertyChanged">
<Binding Path="Email1"
UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<hc:RegexRule Type="Mail"/>
<hc:NoBlankTextRule />
<hc:RegexRule Type="Mail" />
</Binding.ValidationRules>
</Binding>
</hc:TextBox.Text>
</hc:TextBox>
<hc:TextBox Width="380"
hc:InfoElement.TitleWidth="140"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}"
Margin="0,32,0,0"
Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" />
<hc:TextBox hc:InfoElement.ShowClearButton="True"
Width="380"
hc:InfoElement.TitleWidth="140"
hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterContent}}"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}"
hc:InfoElement.Necessary="True"
Margin="0,16,0,0">
<hc:TextBox.Text>
<Binding Path="Text1"
UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<hc:NoBlankTextRule />
</Binding.ValidationRules>
</Binding>
</hc:TextBox.Text>
</hc:TextBox>
<hc:TextBox Width="380" hc:InfoElement.TitleWidth="140" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}" Margin="0,32,0,0" Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"/>
<hc:TextBox hc:InfoElement.ShowClearButton="True" Width="380" hc:InfoElement.TitleWidth="140" hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterContent}}" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}" hc:InfoElement.Necessary="True" Margin="0,16,0,0"/>
</StackPanel>
<StackPanel>
<hc:TextBox hc:InfoElement.ShowClearButton="True" Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" Style="{StaticResource TextBoxPlus.Small}"/>
<hc:TextBox Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" Margin="0,16,0,0" IsEnabled="False" Style="{StaticResource TextBoxPlus.Small}"/>
<hc:TextBox hc:InfoElement.ShowClearButton="True"
Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"
Style="{StaticResource TextBoxPlus.Small}" />
<hc:TextBox Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"
Margin="0,16,0,0"
IsEnabled="False"
Style="{StaticResource TextBoxPlus.Small}" />
<hc:TextBox hc:InfoElement.ShowClearButton="True" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr1}}" Margin="0,32,0,0" Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" Style="{StaticResource TextBoxPlus.Small}"/>
<hc:TextBox hc:InfoElement.ShowClearButton="True" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr1}}" Margin="0,16,0,0" Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" Style="{StaticResource TextBoxPlus.Small}" IsEnabled="False"/>
<hc:TextBox hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterEmail}}" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr2}}" hc:InfoElement.Necessary="True" Margin="0,16,0,0" Style="{StaticResource TextBoxPlus.Small}">
<hc:TextBox hc:InfoElement.ShowClearButton="True"
hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr1}}"
Margin="0,32,0,0"
Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"
Style="{StaticResource TextBoxPlus.Small}" />
<hc:TextBox hc:InfoElement.ShowClearButton="True"
hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr1}}"
Margin="0,16,0,0"
Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"
Style="{StaticResource TextBoxPlus.Small}"
IsEnabled="False" />
<hc:TextBox hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterEmail}}"
hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr2}}"
hc:InfoElement.Necessary="True"
Margin="0,16,0,0"
Style="{StaticResource TextBoxPlus.Small}">
<hc:TextBox.Text>
<Binding Path="Email2" UpdateSourceTrigger="PropertyChanged">
<Binding Path="Email2"
UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<hc:RegexRule Type="Mail"/>
<hc:NoBlankTextRule />
<hc:RegexRule Type="Mail" />
</Binding.ValidationRules>
</Binding>
</hc:TextBox.Text>
</hc:TextBox>
<hc:TextBox Width="380"
hc:InfoElement.TitleWidth="140"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}"
Margin="0,32,0,0"
Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"
Style="{StaticResource TextBoxPlus.Small}" />
<hc:TextBox hc:InfoElement.ShowClearButton="True"
Width="380"
hc:InfoElement.TitleWidth="140"
hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterContent}}"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}"
hc:InfoElement.Necessary="True"
Margin="0,16,0,0"
Style="{StaticResource TextBoxPlus.Small}">
<hc:TextBox.Text>
<Binding Path="Text2"
UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<hc:NoBlankTextRule />
</Binding.ValidationRules>
</Binding>
</hc:TextBox.Text>
</hc:TextBox>
<hc:TextBox Width="380" hc:InfoElement.TitleWidth="140" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}" Margin="0,32,0,0" Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" Style="{StaticResource TextBoxPlus.Small}"/>
<hc:TextBox hc:InfoElement.ShowClearButton="True" Width="380" hc:InfoElement.TitleWidth="140" hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterContent}}" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}" hc:InfoElement.Necessary="True" Margin="0,16,0,0" Style="{StaticResource TextBoxPlus.Small}"/>
</StackPanel>
</hc:UniformSpacingPanel>
</hc:ScrollViewer>
@@ -4,29 +4,124 @@
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
xmlns:ex="clr-namespace:HandyControlDemo.Tools.Extension"
Background="{DynamicResource RegionBrush}">
Background="{DynamicResource RegionBrush}"
DataContext="{Binding InputElementDemo, Source={StaticResource Locator}}">
<hc:TransitioningContentControl>
<hc:ScrollViewer IsInertiaEnabled="True">
<hc:UniformSpacingPanel Spacing="32" Margin="32" ChildWrapping="Wrap">
<hc:UniformSpacingPanel Spacing="32"
Margin="32"
ChildWrapping="Wrap">
<StackPanel>
<TextBox Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"/>
<TextBox Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" Margin="0,16,0,0" IsEnabled="False"/>
<TextBox Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" />
<TextBox Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"
Margin="0,16,0,0"
IsEnabled="False" />
<TextBox hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr1}}" Style="{StaticResource TextBoxExtend}" Margin="0,32,0,0" Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"/>
<TextBox hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr1}}" Style="{StaticResource TextBoxExtend}" Margin="0,16,0,0" Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" IsEnabled="False"/>
<TextBox hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterContent}}" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr2}}" Style="{StaticResource TextBoxExtend}" hc:InfoElement.Necessary="True" Margin="0,16,0,0"/>
<TextBox Width="380" hc:InfoElement.TitleWidth="140" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}" Style="{StaticResource TextBoxExtend}" Margin="0,32,0,0" Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"/>
<TextBox Width="380" hc:InfoElement.TitleWidth="140" hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterContent}}" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}" hc:InfoElement.Necessary="True" Style="{StaticResource TextBoxExtend}" Margin="0,16,0,0"/>
<TextBox hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr1}}"
Style="{StaticResource TextBoxExtend}"
Margin="0,32,0,0"
Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" />
<TextBox hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr1}}"
Style="{StaticResource TextBoxExtend}"
Margin="0,16,0,0"
Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"
IsEnabled="False" />
<TextBox hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterEmail}}"
hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr2}}"
Style="{StaticResource TextBoxExtend}"
hc:InfoElement.Necessary="True"
Margin="0,16,0,0">
<TextBox.Text>
<Binding Path="Email1"
UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<hc:NoBlankTextRule />
<hc:RegexRule Type="Mail" />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBox Width="380"
hc:InfoElement.TitleWidth="140"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}"
Style="{StaticResource TextBoxExtend}"
Margin="0,32,0,0"
Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" />
<TextBox Width="380"
hc:InfoElement.TitleWidth="140"
hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterContent}}"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}"
hc:InfoElement.Necessary="True"
Style="{StaticResource TextBoxExtend}"
Margin="0,16,0,0">
<TextBox.Text>
<Binding Path="Text1"
UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<hc:NoBlankTextRule />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
</StackPanel>
<StackPanel>
<TextBox Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" Style="{StaticResource TextBox.Small}"/>
<TextBox Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" Margin="0,16,0,0" IsEnabled="False" Style="{StaticResource TextBox.Small}"/>
<TextBox Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"
Style="{StaticResource TextBox.Small}" />
<TextBox Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"
Margin="0,16,0,0"
IsEnabled="False"
Style="{StaticResource TextBox.Small}" />
<TextBox hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr1}}" Style="{StaticResource TextBoxExtend.Small}" Margin="0,32,0,0" Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"/>
<TextBox hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr1}}" Style="{StaticResource TextBoxExtend.Small}" Margin="0,16,0,0" Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" IsEnabled="False"/>
<TextBox hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterContent}}" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr2}}" Style="{StaticResource TextBoxExtend.Small}" hc:InfoElement.Necessary="True" Margin="0,16,0,0"/>
<TextBox Width="380" hc:InfoElement.TitleWidth="140" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}" Style="{StaticResource TextBoxExtend.Small}" Margin="0,32,0,0" Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"/>
<TextBox Width="380" hc:InfoElement.TitleWidth="140" hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterContent}}" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}" hc:InfoElement.Necessary="True" Style="{StaticResource TextBoxExtend.Small}" Margin="0,16,0,0"/>
<TextBox hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr1}}"
Style="{StaticResource TextBoxExtend.Small}"
Margin="0,32,0,0"
Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" />
<TextBox hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr1}}"
Style="{StaticResource TextBoxExtend.Small}"
Margin="0,16,0,0"
Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}"
IsEnabled="False" />
<TextBox hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterEmail}}"
hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr2}}"
Style="{StaticResource TextBoxExtend.Small}"
hc:InfoElement.Necessary="True"
Margin="0,16,0,0">
<TextBox.Text>
<Binding Path="Email2"
UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<hc:NoBlankTextRule />
<hc:RegexRule Type="Mail" />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBox Width="380"
hc:InfoElement.TitleWidth="140"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}"
Style="{StaticResource TextBoxExtend.Small}"
Margin="0,32,0,0"
Text="{ex:Lang Key={x:Static langs:LangKeys.ContentDemoStr}}" />
<TextBox Width="380"
hc:InfoElement.TitleWidth="140"
hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterContent}}"
hc:InfoElement.TitlePlacement="Left"
hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}"
hc:InfoElement.Necessary="True"
Style="{StaticResource TextBoxExtend.Small}"
Margin="0,16,0,0">
<TextBox.Text>
<Binding Path="Text2"
UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<hc:NoBlankTextRule />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
</StackPanel>
</hc:UniformSpacingPanel>
</hc:ScrollViewer>
@@ -13,6 +13,8 @@ public class InputElementDemoViewModel : ViewModelBase
{
private string _email1;
private string _email2;
private string _text1;
private string _text2;
private double _doubleValue1;
private double _doubleValue2;
private IList<string> _dataList;
@@ -38,6 +40,26 @@ public class InputElementDemoViewModel : ViewModelBase
#endif
}
public string Text1
{
get => _text1;
#if NET40
set => Set(nameof(Text1), ref _text1, value);
#else
set => Set(ref _text1, value);
#endif
}
public string Text2
{
get => _text2;
#if NET40
set => Set(nameof(Text2), ref _text2, value);
#else
set => Set(ref _text2, value);
#endif
}
public double DoubleValue1
{
get => _doubleValue1;