group demo items

This commit is contained in:
NaBian committed 2021-01-11 00:42:03 +08:00
1 parent 789eeed609
commit 17d2353107
18 files changed
+256 -162

No files matched your search

@@ -2,121 +2,124 @@
{
"title": "Styles",
"selectedIndex": -1,
"group": false,
"demoItemList": [
[ "Brush", "BrushDemoCtl", "Brush_16x", "" ],
[ "Button", "ButtonDemoCtl", "ButtonClick_16x", "" ],
[ "RepeatButton", "RepeatButtonDemoCtl", "RepeatButton_16x", "" ],
[ "ToggleButton", "ToggleButtonDemoCtl", "Toggle_16x", "" ],
[ "RadioButton", "RadioButtonDemoCtl", "RadioButton_16x", "" ],
[ "CheckBox", "CheckBoxDemoCtl", "CheckBox_16x", "" ],
[ "ScrollViewer", "NativeScrollViewerDemoCtl", "ScrollBox_16x", "" ],
[ "Slider", "SliderDemoCtl", "Slider_16x", "" ],
[ "TextBlock", "TextBlockDemoCtl", "TextBlock_16x", "" ],
[ "TextBox", "NativeTextBoxDemoCtl", "TextBox_16x", "" ],
[ "ComboBox", "NativeComboBoxDemoCtl", "ComboBox_16x", "" ],
[ "PasswordBox", "NativePasswordBoxDemoCtl", "PasswordBox_16x", "" ],
[ "Expander", "ExpanderDemoCtl", "Expander_16x", "" ],
[ "ProgressBar", "NativeProgressBarDemoCtl", "ProgressBar_16x", "" ],
[ "Calendar", "CalendarDemoCtl", "Calendar_16x", "" ],
[ "DatePicker", "NativeDatePickerDemoCtl", "DatePicker_16x", "" ],
[ "TabControl", "NativeTabControlDemoCtl", "TabPage_16x", "" ],
[ "DataGrid", "DataGridDemoCtl", "DataGrid_16x", "" ],
[ "TreeView", "TreeViewDemoCtl", "TreeView_16x", "" ],
[ "ListBox", "ListBoxDemoCtl", "ListBox_16x", "" ],
[ "ListView", "ListViewDemoCtl", "ListView_16x", "" ],
[ "GroupBox", "GroupBoxDemoCtl", "GroupBox_16x", "" ],
[ "Menu", "MenuDemoCtl", "ContextMenu_16x", "" ],
[ "RichTextBox", "RichTextBoxDemoCtl", "RichTextBox_16x", "" ],
[ "FlowDocument", "FlowDocumentDemoCtl", "WPFFlowDocument_16x", "" ],
[ "ToolBar", "ToolBarDemoCtl", "ToolBar_16x", "" ],
[ "Border", "BorderDemoCtl", "BorderElement_16x", "" ],
[ "Label", "LabelDemoCtl", "Label_16x", "" ],
[ "Frame", "FrameDemoCtl", "frame_16xLG", "" ],
[ "Window", "NativeWindowDemoCtl", "WindowsForm_16x", "" ],
[ "Geometry", "GeometryDemoCtl", "Path_16x", "1" ]
[ "Brush", "BrushDemoCtl", "Brush_16x", "", "" ],
[ "Button", "ButtonDemoCtl", "ButtonClick_16x", "", "" ],
[ "RepeatButton", "RepeatButtonDemoCtl", "RepeatButton_16x", "", "" ],
[ "ToggleButton", "ToggleButtonDemoCtl", "Toggle_16x", "", "" ],
[ "RadioButton", "RadioButtonDemoCtl", "RadioButton_16x", "", "" ],
[ "CheckBox", "CheckBoxDemoCtl", "CheckBox_16x", "", "" ],
[ "ScrollViewer", "NativeScrollViewerDemoCtl", "ScrollBox_16x", "", "" ],
[ "Slider", "SliderDemoCtl", "Slider_16x", "", "" ],
[ "TextBlock", "TextBlockDemoCtl", "TextBlock_16x", "", "" ],
[ "TextBox", "NativeTextBoxDemoCtl", "TextBox_16x", "", "" ],
[ "ComboBox", "NativeComboBoxDemoCtl", "ComboBox_16x", "", "" ],
[ "PasswordBox", "NativePasswordBoxDemoCtl", "PasswordBox_16x", "", "" ],
[ "Expander", "ExpanderDemoCtl", "Expander_16x", "", "" ],
[ "ProgressBar", "NativeProgressBarDemoCtl", "ProgressBar_16x", "", "" ],
[ "Calendar", "CalendarDemoCtl", "Calendar_16x", "", "" ],
[ "DatePicker", "NativeDatePickerDemoCtl", "DatePicker_16x", "", "" ],
[ "TabControl", "NativeTabControlDemoCtl", "TabPage_16x", "", "" ],
[ "DataGrid", "DataGridDemoCtl", "DataGrid_16x", "", "" ],
[ "TreeView", "TreeViewDemoCtl", "TreeView_16x", "", "" ],
[ "ListBox", "ListBoxDemoCtl", "ListBox_16x", "", "" ],
[ "ListView", "ListViewDemoCtl", "ListView_16x", "", "" ],
[ "GroupBox", "GroupBoxDemoCtl", "GroupBox_16x", "", "" ],
[ "Menu", "MenuDemoCtl", "ContextMenu_16x", "", "" ],
[ "RichTextBox", "RichTextBoxDemoCtl", "RichTextBox_16x", "", "" ],
[ "FlowDocument", "FlowDocumentDemoCtl", "WPFFlowDocument_16x", "", "" ],
[ "ToolBar", "ToolBarDemoCtl", "ToolBar_16x", "", "" ],
[ "Border", "BorderDemoCtl", "BorderElement_16x", "", "" ],
[ "Label", "LabelDemoCtl", "Label_16x", "", "" ],
[ "Frame", "FrameDemoCtl", "frame_16xLG", "", "" ],
[ "Window", "NativeWindowDemoCtl", "WindowsForm_16x", "", "" ],
[ "Geometry", "GeometryDemoCtl", "Path_16x", "1", "" ]
]
},
{
"title": "Controls",
"selectedIndex": 0,
"group": true,
"demoItemList": [
[ "FloatingBlock", "FloatingBlockDemoCtl", "thumbs_up", "" ],
[ "PropertyGrid", "PropertyGridDemoCtl", "PropertyGridEditorPart_16x", "1" ],
[ "ImageSelector", "ImageSelectorDemoCtl", "Image_16x", "1" ],
[ "ImageBlock", "ImageBlockDemoCtl", "ImageStack_16x", "" ],
[ "Magnifier", "MagnifierDemoCtl", "Search_16x", "" ],
[ "Gravatar", "GravatarDemoCtl", "User_16x", "" ],
[ "Badge", "BadgeDemoCtl", "DotLarge_16x", "" ],
[ "GotoTop", "GotoTopDemoCtl", "GoToTop_16x", "" ],
[ "SplitButton", "SplitButtonDemoCtl", "SplitButton_16x", "" ],
[ "ButtonGroup", "ButtonGroupDemoCtl", "ButtonGroup_16x", "" ],
[ "ProgressButton", "ProgressButtonDemoCtl", "ProgressButton_16x", "" ],
[ "ChatBubble", "ChatBubbleDemoCtl", "Bubble_16xLG", "" ],
[ "Poptip", "PoptipDemoCtl", "PopupCursor_16x", "" ],
[ "NotifyIcon", "NotifyIconDemoCtl", "NotificationHub_16x", "" ],
[ "NumericUpDown", "NumericUpDownDemoCtl", "NumericListBox_16x", "" ],
[ "TextBox", "TextBoxDemoCtl", "TextBox_16x", "" ],
[ "ComboBox", "ComboBoxDemoCtl", "ComboBox_16x", "" ],
[ "CheckComboBox", "CheckComboBoxDemoCtl", "CheckBoxList_16x", "1" ],
[ "PasswordBox", "PasswordBoxDemoCtl", "PasswordBox_16x", "" ],
[ "PinBox", "PinBoxDemoCtl", "Ellipsis_16x", "" ],
[ "DatePicker", "DatePickerDemoCtl", "DatePicker_16x", "" ],
[ "Clock", "ClockDemoCtl", "Time_color_16x", "" ],
[ "TimePicker", "TimePickerDemoCtl", "TimePicker_16x", "" ],
[ "CalendarWithClock", "CalendarWithClockDemoCtl", "Calendar_16x", "" ],
[ "DateTimePicker", "DateTimePickerDemoCtl", "DatePicker_16x", "" ],
[ "Transfer", "TransferDemoCtl", "Transfer_16x", "" ],
[ "FlipClock", "FlipClockDemoCtl", "FlipVertical_16x", "" ],
[ "Rate", "RateDemoCtl", "Star", "" ],
[ "Shield", "ShieldDemoCtl", "Shield_16x", "" ],
[ "SearchBar", "SearchBarDemoCtl", "Search_16x", "" ],
[ "Tag", "TagDemoCtl", "Tag_16x", "" ],
[ "GifImage", "GifImageDemoCtl", "Animation_16x", "" ],
[ "OutlineText", "OutlineTextDemoCtl", "TextBlock_16x", "" ],
[ "RunningBlock", "RunningBlockDemoCtl", "Dynamic_16x", "" ],
[ "Card", "CardDemoCtl", "VSO_Card_16x", "" ],
[ "Divider", "DividerDemoCtl", "DottedSplitter_16x", "" ],
[ "CirclePanel", "CirclePanelDemoCtl", "ColorWheel_16x", "" ],
[ "Grid", "GridDemoCtl", "GridPane_16x", "" ],
[ "FlexPanel", "FlexPanelDemoCtl", "layout-FlexLayout-16", "1" ],
[ "UniformSpacingPanel", "UniformSpacingPanelDemoCtl", "IncreaseHorizontalSpacing_16x", "1" ],
[ "RelativePanel", "RelativePanelDemoCtl", "TransformRelative_16x", "" ],
[ "WaterfallPanel", "WaterfallPanelDemoCtl", "Panel_16x", "" ],
[ "HoneycombPanel", "HoneycombPanelDemoCtl", "PolygonHexagon_16x", "" ],
[ "TransitioningContentControl", "TransitioningContentControlDemoCtl", "TransitioningContentControl_16x", "" ],
[ "Drawer", "DrawerDemoCtl", "View_Portrait_16x", "" ],
[ "CoverView", "CoverViewDemoCtl", "DetailDataView_16x", "" ],
[ "CoverFlow", "CoverFlowDemoCtl", "LinearCarousel_16x", "" ],
[ "ProgressBar", "ProgressBarDemoCtl", "ProgressBar_16x", "" ],
[ "StepBar", "StepBarDemoCtl", "Flow_16x", "" ],
[ "Growl", "GrowlDemoCtl", "Message_16x", "" ],
[ "Loading", "LoadingDemoCtl", "Loading_Blue_16x", "" ],
[ "ImageBrowser", "ImageBrowserDemoCtl", "ImageBrowser_16x", "" ],
[ "ColorPicker", "ColorPickerDemoCtl", "ColorPalette_16x", "" ],
[ "Carousel", "CarouselDemoCtl", "Carousel_16x", "" ],
[ "CompareSlider", "CompareSliderDemoCtl", "SplitterControl_16x", "" ],
[ "PreviewSlider", "PreviewSliderDemoCtl", "HoverMenu_16x", "" ],
[ "RangeSlider", "RangeSliderDemoCtl", "brackets_Square_16xLG", "" ],
[ "TimeBar", "TimeBarDemoCtl", "Timeline_16x", "" ],
[ "Pagination", "PaginationDemoCtl", "Paginator_16x", "" ],
[ "AnimationPath", "AnimationPathDemoCtl", "Path_16x", "" ],
[ "TabControl", "TabControlDemoCtl", "TabPage_16x", "" ],
[ "SideMenu", "SideMenuDemoCtl", "MainMenuControl_16x", "" ],
[ "ScrollViewer", "ScrollViewerDemoCtl", "ScrollBox_16x", "" ],
[ "Sprite", "SpriteDemoCtl", "HandyControl", "" ],
[ "Notification", "NotificationDemoCtl", "Procedure_16x", "" ],
[ "Dialog", "DialogDemoCtl", "Dialog_16x", "" ],
[ "Screenshot", "ScreenshotDemoCtl", "WindowScreenshot_16x", "" ],
[ "Window", "WindowDemoCtl", "WindowsForm_16x", "" ]
[ "FloatingBlock", "FloatingBlockDemoCtl", "thumbs_up", "", "" ],
[ "PropertyGrid", "PropertyGridDemoCtl", "PropertyGridEditorPart_16x", "1", "" ],
[ "ImageSelector", "ImageSelectorDemoCtl", "Image_16x", "1", "" ],
[ "ImageBlock", "ImageBlockDemoCtl", "ImageStack_16x", "", "" ],
[ "Magnifier", "MagnifierDemoCtl", "Search_16x", "", "" ],
[ "Gravatar", "GravatarDemoCtl", "User_16x", "", "" ],
[ "Badge", "BadgeDemoCtl", "DotLarge_16x", "", "" ],
[ "GotoTop", "GotoTopDemoCtl", "GoToTop_16x", "", "" ],
[ "SplitButton", "SplitButtonDemoCtl", "SplitButton_16x", "", "" ],
[ "ButtonGroup", "ButtonGroupDemoCtl", "ButtonGroup_16x", "", "" ],
[ "ProgressButton", "ProgressButtonDemoCtl", "ProgressButton_16x", "", "" ],
[ "ChatBubble", "ChatBubbleDemoCtl", "Bubble_16xLG", "", "" ],
[ "Poptip", "PoptipDemoCtl", "PopupCursor_16x", "", "" ],
[ "NotifyIcon", "NotifyIconDemoCtl", "NotificationHub_16x", "", "" ],
[ "NumericUpDown", "NumericUpDownDemoCtl", "NumericListBox_16x", "", "" ],
[ "TextBox", "TextBoxDemoCtl", "TextBox_16x", "", "" ],
[ "ComboBox", "ComboBoxDemoCtl", "ComboBox_16x", "", "" ],
[ "CheckComboBox", "CheckComboBoxDemoCtl", "CheckBoxList_16x", "1", "" ],
[ "PasswordBox", "PasswordBoxDemoCtl", "PasswordBox_16x", "", "" ],
[ "PinBox", "PinBoxDemoCtl", "Ellipsis_16x", "", "" ],
[ "DatePicker", "DatePickerDemoCtl", "DatePicker_16x", "", "" ],
[ "Clock", "ClockDemoCtl", "Time_color_16x", "", "" ],
[ "TimePicker", "TimePickerDemoCtl", "TimePicker_16x", "", "" ],
[ "CalendarWithClock", "CalendarWithClockDemoCtl", "Calendar_16x", "", "" ],
[ "DateTimePicker", "DateTimePickerDemoCtl", "DatePicker_16x", "", "" ],
[ "Transfer", "TransferDemoCtl", "Transfer_16x", "", "" ],
[ "FlipClock", "FlipClockDemoCtl", "FlipVertical_16x", "", "" ],
[ "Rate", "RateDemoCtl", "Star", "", "" ],
[ "Shield", "ShieldDemoCtl", "Shield_16x", "", "" ],
[ "SearchBar", "SearchBarDemoCtl", "Search_16x", "", "" ],
[ "Tag", "TagDemoCtl", "Tag_16x", "", "" ],
[ "GifImage", "GifImageDemoCtl", "Animation_16x", "", "" ],
[ "OutlineText", "OutlineTextDemoCtl", "TextBlock_16x", "", "" ],
[ "RunningBlock", "RunningBlockDemoCtl", "Dynamic_16x", "", "" ],
[ "Card", "CardDemoCtl", "VSO_Card_16x", "", "" ],
[ "Divider", "DividerDemoCtl", "DottedSplitter_16x", "", "" ],
[ "CirclePanel", "CirclePanelDemoCtl", "ColorWheel_16x", "", "Layout" ],
[ "Grid", "GridDemoCtl", "GridPane_16x", "", "Layout" ],
[ "FlexPanel", "FlexPanelDemoCtl", "layout-FlexLayout-16", "1", "Layout" ],
[ "UniformSpacingPanel", "UniformSpacingPanelDemoCtl", "IncreaseHorizontalSpacing_16x", "1", "Layout" ],
[ "RelativePanel", "RelativePanelDemoCtl", "TransformRelative_16x", "", "Layout" ],
[ "WaterfallPanel", "WaterfallPanelDemoCtl", "Panel_16x", "", "Layout" ],
[ "HoneycombPanel", "HoneycombPanelDemoCtl", "PolygonHexagon_16x", "", "Layout" ],
[ "TransitioningContentControl", "TransitioningContentControlDemoCtl", "TransitioningContentControl_16x", "", "" ],
[ "Drawer", "DrawerDemoCtl", "View_Portrait_16x", "", "" ],
[ "CoverView", "CoverViewDemoCtl", "DetailDataView_16x", "", "" ],
[ "CoverFlow", "CoverFlowDemoCtl", "LinearCarousel_16x", "", "" ],
[ "ProgressBar", "ProgressBarDemoCtl", "ProgressBar_16x", "", "Feedback" ],
[ "StepBar", "StepBarDemoCtl", "Flow_16x", "", "Navigation" ],
[ "Growl", "GrowlDemoCtl", "Message_16x", "", "Feedback" ],
[ "Loading", "LoadingDemoCtl", "Loading_Blue_16x", "", "" ],
[ "ImageBrowser", "ImageBrowserDemoCtl", "ImageBrowser_16x", "", "" ],
[ "ColorPicker", "ColorPickerDemoCtl", "ColorPalette_16x", "", "" ],
[ "Carousel", "CarouselDemoCtl", "Carousel_16x", "", "" ],
[ "CompareSlider", "CompareSliderDemoCtl", "SplitterControl_16x", "", "" ],
[ "PreviewSlider", "PreviewSliderDemoCtl", "HoverMenu_16x", "", "" ],
[ "RangeSlider", "RangeSliderDemoCtl", "brackets_Square_16xLG", "", "" ],
[ "TimeBar", "TimeBarDemoCtl", "Timeline_16x", "", "" ],
[ "Pagination", "PaginationDemoCtl", "Paginator_16x", "", "" ],
[ "AnimationPath", "AnimationPathDemoCtl", "Path_16x", "", "" ],
[ "TabControl", "TabControlDemoCtl", "TabPage_16x", "", "" ],
[ "SideMenu", "SideMenuDemoCtl", "MainMenuControl_16x", "", "" ],
[ "ScrollViewer", "ScrollViewerDemoCtl", "ScrollBox_16x", "", "" ],
[ "Sprite", "SpriteDemoCtl", "HandyControl", "", "" ],
[ "Notification", "NotificationDemoCtl", "Procedure_16x", "", "" ],
[ "Dialog", "DialogDemoCtl", "Dialog_16x", "", "" ],
[ "Screenshot", "ScreenshotDemoCtl", "WindowScreenshot_16x", "", "" ],
[ "Window", "WindowDemoCtl", "WindowsForm_16x", "", "" ]
]
},
{
"title": "Tools",
"selectedIndex": 0,
"group": false,
"demoItemList": [
[ "HatchBrushGenerator", "HatchBrushGeneratorDemoCtl", "DataGenerator_16x", "" ],
[ "Morphing_Animation", "GeometryAnimationDemoCtl", "Animation_16x", "" ],
[ "Effects", "EffectsDemoCtl", "Effects_16x", "" ]
[ "HatchBrushGenerator", "HatchBrushGeneratorDemoCtl", "DataGenerator_16x", "", "" ],
[ "Morphing_Animation", "GeometryAnimationDemoCtl", "Animation_16x", "", "" ],
[ "Effects", "EffectsDemoCtl", "Effects_16x", "", "" ]
]
}
]
@@ -31,6 +31,8 @@ namespace HandyControlDemo.Data
#endif
}
public bool IsGroupEnabled { get; set; }
public IList<DemoItemModel> DemoItemList { get; set; }
}
}
@@ -6,6 +6,8 @@ namespace HandyControlDemo.Data
{
public string Name { get; set; }
public string GroupName { get; set; }
public string TargetCtlName { get; set; }
public string ImageName { get; set; }
@@ -1210,6 +1210,17 @@ namespace HandyControlDemo.Properties.Langs
}
}
/// <summary>
/// 查找类似 杂项 的本地化字符串。
/// </summary>
public static string Misc
{
get
{
return ResourceManager.GetString("Misc", resourceCulture);
}
}
/// <summary>
/// 查找类似 变形动画 的本地化字符串。
/// </summary>
@@ -771,4 +771,7 @@
<data name="UniformSpacingPanel" xml:space="preserve">
<value>UniformSpacingPanel</value>
</data>
<data name="Misc" xml:space="preserve">
<value>Misc</value>
</data>
</root>
@@ -771,4 +771,7 @@
<data name="UniformSpacingPanel" xml:space="preserve">
<value>UniformSpacingPanel</value>
</data>
<data name="Misc" xml:space="preserve">
<value>Misc</value>
</data>
</root>
@@ -771,4 +771,7 @@
<data name="UniformSpacingPanel" xml:space="preserve">
<value>UniformSpacingPanel</value>
</data>
<data name="Misc" xml:space="preserve">
<value>Misc</value>
</data>
</root>
@@ -771,4 +771,7 @@
<data name="UniformSpacingPanel" xml:space="preserve">
<value>UniformSpacingPanel</value>
</data>
<data name="Misc" xml:space="preserve">
<value>Misc</value>
</data>
</root>
@@ -771,4 +771,7 @@
<data name="UniformSpacingPanel" xml:space="preserve">
<value>UniformSpacingPanel</value>
</data>
<data name="Misc" xml:space="preserve">
<value>Misc</value>
</data>
</root>
@@ -771,4 +771,7 @@
<data name="UniformSpacingPanel" xml:space="preserve">
<value>UniformSpacingPanel</value>
</data>
<data name="Misc" xml:space="preserve">
<value>Misc</value>
</data>
</root>
@@ -771,4 +771,7 @@
<data name="UniformSpacingPanel" xml:space="preserve">
<value>等间距布局</value>
</data>
<data name="Misc" xml:space="preserve">
<value>杂项</value>
</data>
</root>
@@ -771,4 +771,7 @@
<data name="UniformSpacingPanel" xml:space="preserve">
<value>UniformSpacingPanel</value>
</data>
<data name="Misc" xml:space="preserve">
<value>Misc</value>
</data>
</root>
@@ -771,4 +771,7 @@
<data name="UniformSpacingPanel" xml:space="preserve">
<value>UniformSpacingPanel</value>
</data>
<data name="Misc" xml:space="preserve">
<value>Misc</value>
</data>
</root>
@@ -203,4 +203,17 @@
</Style.Triggers>
</Style>
</ResourceDictionary>
<Style x:Key="DemoGroupItemStyle" TargetType="GroupItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GroupItem">
<hc:SimpleStackPanel>
<hc:Divider Content="{Binding Name}" LineStrokeDashArray="2, 2" Padding="16,0"/>
<ItemsPresenter Margin="{TemplateBinding Padding}"/>
</hc:SimpleStackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
@@ -383,14 +383,18 @@ namespace HandyControlDemo.Service
{
var titleKey = (string) item.title;
var title = titleKey;
var list = Convert2DemoItemList(item.demoItemList);
infoList.Add(new DemoInfoModel
List<DemoItemModel> list = Convert2DemoItemList(item.demoItemList);
var demoInfoModel = new DemoInfoModel
{
Key = titleKey,
Title = title,
DemoItemList = list,
SelectedIndex = (int) item.selectedIndex
});
SelectedIndex = (int) item.selectedIndex,
IsGroupEnabled = (bool) item.group
};
infoList.Add(demoInfoModel);
}
return infoList;
@@ -406,13 +410,19 @@ namespace HandyControlDemo.Service
string targetCtlName = item[1];
string imageName = item[2];
var isNew = !string.IsNullOrEmpty((string) item[3]);
var groupName = (string) item[4];
if (string.IsNullOrEmpty(groupName))
{
groupName = "Misc";
}
resultList.Add(new DemoItemModel
{
Name = name,
TargetCtlName = targetCtlName,
ImageName = $"../../Resources/Img/LeftMainContent/{imageName}.png",
IsNew = isNew
IsNew = isNew,
GroupName = groupName
});
}
@@ -46,7 +46,7 @@
</Grid.ColumnDefinitions>
<hc:SearchBar ShowClearButton="True" IsRealTime="True" SearchStarted="SearchBar_OnSearchStarted" Style="{StaticResource SearchBarPlus}" hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterKey}}" Margin="0,4,4,4" Tag="{Binding ElementName=ListBoxDemo}"/>
<ToggleButton Tag="{Binding ElementName=ListBoxDemo}" Name="ButtonStyleAscending" Click="ButtonAscending_OnClick" Grid.Row="0" Grid.Column="1" Style="{StaticResource DemoInfoSortButtonStyle}"/>
<ListBox Name="ListBoxDemo" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" VirtualizingStackPanel.IsVirtualizing="True" SelectedIndex="{Binding SelectedIndex}" ItemsSource="{Binding DemoItemList}" BorderThickness="0" SelectionMode="Single" Style="{StaticResource ListBoxTransparent}">
<ListBox Name="ListBoxDemo" ScrollViewer.CanContentScroll="False" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" VirtualizingStackPanel.IsVirtualizing="True" SelectedIndex="{Binding SelectedIndex}" ItemsSource="{Binding DemoItemList}" BorderThickness="0" SelectionMode="Single" Style="{StaticResource ListBoxTransparent}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
@@ -56,6 +56,9 @@
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.GroupStyle>
<GroupStyle ContainerStyle="{StaticResource DemoGroupItemStyle}"/>
</ListBox.GroupStyle>
</ListBox>
</Grid>
</DataTemplate>
@@ -67,4 +70,4 @@
</hc:Interaction.Triggers>
</TabControl>
</DockPanel>
</Border>
</Border>
@@ -1,8 +1,12 @@
using System.ComponentModel;
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Threading;
using HandyControl.Data;
using HandyControl.Tools;
using HandyControlDemo.Data;
using HandyControlDemo.ViewModel;
@@ -30,7 +34,9 @@ namespace HandyControlDemo.UserControl
var selectedIndex = demoInfo.SelectedIndex;
demoInfo.SelectedIndex = -1;
demoInfo.SelectedIndex = selectedIndex;
FilterItems();
GroupItems(sender as TabControl, demoInfo);
}
}
@@ -92,5 +98,20 @@ namespace HandyControlDemo.UserControl
}
}
}
private void GroupItems(TabControl tabControl, DemoInfoModel demoInfo)
{
var listBox = VisualHelper.GetChild<ListBox>(tabControl);
if (listBox == null) return;
listBox.Items.GroupDescriptions?.Clear();
if (demoInfo.IsGroupEnabled)
{
Dispatcher.BeginInvoke(new Action(() =>
{
listBox.Items.GroupDescriptions?.Add(new PropertyGroupDescription("GroupName"));
}), DispatcherPriority.Background);
}
}
}
}
@@ -30,64 +30,16 @@ namespace HandyControlDemo.ViewModel
/// </summary>
private object _subContent;
private DataService _dataService;
private readonly DataService _dataService;
#endregion
public MainViewModel(DataService dataService)
{
_dataService = dataService;
Messenger.Default.Register<object>(this, MessageToken.LoadShowContent, obj =>
{
if (SubContent is IDisposable disposable)
{
disposable.Dispose();
}
SubContent = obj;
}, true);
Messenger.Default.Register<object>(this, MessageToken.ClearLeftSelected, obj =>
{
DemoItemCurrent = null;
foreach (var item in DemoInfoCollection)
{
item.SelectedIndex = -1;
}
});
Messenger.Default.Register<object>(this, MessageToken.LangUpdated, obj =>
{
if (DemoItemCurrent == null) return;
ContentTitle = LangProvider.GetLang(DemoItemCurrent.Name);
});
DemoInfoCollection = new ObservableCollection<DemoInfoModel>();
#if NET40
Task.Factory.StartNew(() =>
{
DataList = dataService.GetDemoDataList();
foreach (var item in dataService.GetDemoInfo())
{
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{
DemoInfoCollection.Add(item);
}), DispatcherPriority.ApplicationIdle);
}
});
#else
Task.Run(() =>
{
DataList = dataService.GetDemoDataList();
foreach (var item in dataService.GetDemoInfo())
{
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{
DemoInfoCollection.Add(item);
}), DispatcherPriority.ApplicationIdle);
}
});
#endif
UpdateMainContent();
UpdateLeftContent();
}
#region 属性
@@ -160,6 +112,56 @@ namespace HandyControlDemo.ViewModel
#region 方法
private void UpdateMainContent()
{
Messenger.Default.Register<object>(this, MessageToken.LoadShowContent, obj =>
{
if (SubContent is IDisposable disposable)
{
disposable.Dispose();
}
SubContent = obj;
}, true);
}
private void UpdateLeftContent()
{
//clear status
Messenger.Default.Register<object>(this, MessageToken.ClearLeftSelected, obj =>
{
DemoItemCurrent = null;
foreach (var item in DemoInfoCollection)
{
item.SelectedIndex = -1;
}
});
Messenger.Default.Register<object>(this, MessageToken.LangUpdated, obj =>
{
if (DemoItemCurrent == null) return;
ContentTitle = LangProvider.GetLang(DemoItemCurrent.Name);
});
//load items
DemoInfoCollection = new ObservableCollection<DemoInfoModel>();
#if NET40
Task.Factory.StartNew(() =>
#else
Task.Run(() =>
#endif
{
DataList = _dataService.GetDemoDataList();
foreach (var item in _dataService.GetDemoInfo())
{
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{
DemoInfoCollection.Add(item);
}), DispatcherPriority.ApplicationIdle);
}
});
}
/// <summary>
/// 切换例子
/// </summary>