completed the branch
This commit is contained in:
1 parent
ae36827885
commit
0d91919b14
5 files changed
+106
-14
No files matched your search
@@ -16,18 +16,30 @@
|
||||
<hc:TransitioningContentControl>
|
||||
<StackPanel Margin="11">
|
||||
<hc:TagContainer Name="Container1" Margin="11" Width="420" Padding="5">
|
||||
<hc:Tag Margin="5" ShowCloseButton="False" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=2}"/>
|
||||
<hc:Tag Header="H" hc:TitleElement.Background="{DynamicResource PrimaryBrush}" Margin="5" ShowCloseButton="False" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=2}"/>
|
||||
<hc:Tag Margin="5" Selectable="True" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=3}"/>
|
||||
<hc:Tag Margin="5" ShowCloseButton="False" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=4}"/>
|
||||
<hc:Tag Margin="5" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=5}"/>
|
||||
<hc:Tag Margin="5" IsSelected="True" Selectable="True" ShowCloseButton="False" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=4}"/>
|
||||
<hc:Tag Margin="5" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=3}"/>
|
||||
<hc:Tag Margin="5" ShowCloseButton="False" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=2}"/>
|
||||
<hc:Tag Margin="5" IsSelected="True" Selectable="True" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=3}"/>
|
||||
<hc:Tag Margin="5" ShowCloseButton="False" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=2}">
|
||||
<hc:Tag.Header>
|
||||
<Image Source="/Resources/Img/Album/1.jpg"/>
|
||||
</hc:Tag.Header>
|
||||
</hc:Tag>
|
||||
<hc:Tag Margin="5" IsSelected="True" Selectable="True" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=3}">
|
||||
<hc:Tag.Header>
|
||||
<Image Source="/Resources/Img/Avatar/avatar2.png"/>
|
||||
</hc:Tag.Header>
|
||||
</hc:Tag>
|
||||
<hc:Tag Margin="5" ShowCloseButton="False" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=4}"/>
|
||||
<hc:Tag Margin="5" Content="{ex:Lang Key={x:Static langs:LangKeys.Text}, Converter={StaticResource StringRepeatConverter}, ConverterParameter=5}"/>
|
||||
</hc:TagContainer>
|
||||
<hc:TagContainer ItemContainerStyle="{StaticResource TagCustomStyle}" Margin="11" Width="420" Padding="5" ItemsSource="{Binding DataList}"/>
|
||||
<DockPanel LastChildFill="True" Margin="11,0,11,11">
|
||||
<Button Command="{Binding AddItemCmd}" Margin="10,0,0,0" DockPanel.Dock="Right" Content="{ex:Lang Key={x:Static langs:LangKeys.AddItem}}"/>
|
||||
<TextBox Text="{Binding TagName}"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
</hc:TransitioningContentControl>
|
||||
</UserControl>
|
||||
@@ -1,13 +1,50 @@
|
||||
using HandyControlDemo.Data;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using HandyControl.Controls;
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Properties.Langs;
|
||||
using HandyControlDemo.Service;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class TagDemoViewModel : DemoViewModelBase<DemoDataModel>
|
||||
public class TagDemoViewModel : ViewModelBase
|
||||
{
|
||||
public TagDemoViewModel(DataService dataService)
|
||||
{
|
||||
DataList = dataService.GetDemoDataList(10);
|
||||
DataList = new ObservableCollection<DemoDataModel>(dataService.GetDemoDataList(10));
|
||||
}
|
||||
|
||||
public ObservableCollection<DemoDataModel> DataList { get; set; }
|
||||
|
||||
private string _tagName;
|
||||
|
||||
public string TagName
|
||||
{
|
||||
get => _tagName;
|
||||
#if NET40
|
||||
set => Set(nameof(TagName), ref _tagName, value);
|
||||
#else
|
||||
set => Set(ref _tagName, value);
|
||||
#endif
|
||||
}
|
||||
|
||||
public RelayCommand AddItemCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(TagName))
|
||||
{
|
||||
Growl.Warning(Lang.PlsEnterContent);
|
||||
return;
|
||||
}
|
||||
|
||||
DataList.Insert(0, new DemoDataModel
|
||||
{
|
||||
IsSelected = DataList.Count % 2 == 0,
|
||||
Name = TagName
|
||||
});
|
||||
TagName = string.Empty;
|
||||
})).Value;
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ namespace HandyControlDemo.ViewModel
|
||||
|
||||
public SplitButtonDemoViewModel SplitButtonDemo => SimpleIoc.Default.GetInstance<SplitButtonDemoViewModel>();
|
||||
|
||||
public TagDemoViewModel TagDemo => SimpleIoc.Default.GetInstance<TagDemoViewModel>();
|
||||
public TagDemoViewModel TagDemo => new TagDemoViewModel(SimpleIoc.Default.GetInstance<DataService>());
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user