mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-03-24 17:03:49 +08:00
AddressBook FolderUI
This commit is contained in:
BIN
Tutorial/GacUI_Controls/AddressBook/UI/Edit.png
Normal file
BIN
Tutorial/GacUI_Controls/AddressBook/UI/Edit.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 388 B |
Binary file not shown.
|
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 206 B |
@@ -23,8 +23,14 @@
|
||||
{
|
||||
interface ICategory
|
||||
{
|
||||
func GetParent() : ICategory*;
|
||||
prop Parent : ICategory* {GetParent}
|
||||
|
||||
func GetName() : string;
|
||||
prop Name : string {GetName}
|
||||
|
||||
func GetImage() : presentation::GuiImageData^;
|
||||
prop Image : presentation::GuiImageData^ {GetImage}
|
||||
|
||||
func GetFolders() : ObservableList^;
|
||||
prop Folders : ObservableList^ {GetFolders}
|
||||
@@ -36,6 +42,14 @@
|
||||
interface IViewModel
|
||||
{
|
||||
func GetRootCategory() : ICategory^;
|
||||
|
||||
func GetSelectedCategory() : ICategory^;
|
||||
func SetSelectedCategory(value : ICategory^) : void;
|
||||
event SelectedCategoryChanged();
|
||||
prop SelectedCategory : ICategory^ {GetSelectedCategory, SetSelectedCategory : SelectedCategoryChanged}
|
||||
|
||||
func AddCategory(name : string) : void;
|
||||
func RemoveCategory() : void;
|
||||
}
|
||||
}
|
||||
</Workflow-ViewModel>
|
||||
@@ -48,6 +62,7 @@
|
||||
|
||||
<Image content="File" name="Folder">Folder.png</Image>
|
||||
<Image content="File" name="Contact">Contact.png</Image>
|
||||
<Image content="File" name="Edit">Edit.png</Image>
|
||||
|
||||
<Image content="File" name="BigIcon">ListView_Big.png</Image>
|
||||
<Image content="File" name="SmallIcon">ListView_Small.png</Image>
|
||||
@@ -64,11 +79,17 @@
|
||||
<Window Text="AddressBook" ClientSize="x:480 y:320">
|
||||
<att.BoundsComposition-set PreferredMinSize="x:480 y:320"/>
|
||||
|
||||
<att.ViewModel-set>
|
||||
<att.SelectedCategory-bind>treeViewFolders.SelectedItem as (demo::ICategory^)</att.SelectedCategory-bind>
|
||||
</att.ViewModel-set>
|
||||
|
||||
<ToolstripCommand ref.Name="commandNewFolder" Image-uri="res://Images/NewFolder">
|
||||
<ev.Executed>commandNewFolder_Executed</ev.Executed>
|
||||
<att.Enabled-bind>ViewModel.SelectedCategory is not null</att.Enabled-bind>
|
||||
<ev.Executed-eval>{}</ev.Executed-eval>
|
||||
</ToolstripCommand>
|
||||
<ToolstripCommand ref.Name="commandDeleteFolder" Image-uri="res://Images/Delete">
|
||||
<ev.Executed>commandDeleteFolder_Executed</ev.Executed>
|
||||
<att.Enabled-bind>ViewModel.SelectedCategory is null ? false : ViewModel.SelectedCategory.Parent is not null</att.Enabled-bind>
|
||||
<ev.Executed-eval>{ ViewModel.RemoveCategory(); }</ev.Executed-eval>
|
||||
</ToolstripCommand>
|
||||
<ToolstripCommand ref.Name="commandNewContact" Image-uri="res://Images/NewContact">
|
||||
<ev.Executed>commandNewContact_Executed</ev.Executed>
|
||||
@@ -101,7 +122,7 @@
|
||||
<CellOption>composeType:Percentage percentage:1.0</CellOption>
|
||||
</att.Rows>
|
||||
<att.Columns>
|
||||
<CellOption>composeType:Absolute absolute:160</CellOption>
|
||||
<CellOption>composeType:Absolute absolute:180</CellOption>
|
||||
<CellOption>composeType:Percentage percentage:1.0</CellOption>
|
||||
</att.Columns>
|
||||
|
||||
@@ -130,7 +151,11 @@
|
||||
</Cell>
|
||||
|
||||
<Cell Site="row:1 column:0">
|
||||
<BindableTreeView ref.Name="treeViewFolders" ItemSource-eval="ViewModel.GetRootCategory()" HorizontalAlwaysVisible="false" VerticalAlwaysVisible="false">
|
||||
<BindableTreeView ref.Name="treeViewFolders" HorizontalAlwaysVisible="false" VerticalAlwaysVisible="false">
|
||||
<att.ItemSource-eval>ViewModel.GetRootCategory()</att.ItemSource-eval>
|
||||
<att.TextProperty>Name</att.TextProperty>
|
||||
<att.ImageProperty>Image</att.ImageProperty>
|
||||
<att.ChildrenProperty>Folders</att.ChildrenProperty>
|
||||
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
|
||||
</BindableTreeView>
|
||||
</Cell>
|
||||
|
||||
@@ -23,10 +23,14 @@ namespace vl
|
||||
|
||||
BEGIN_CLASS_MEMBER(demo::ICategory)
|
||||
CLASS_MEMBER_BASE(vl::reflection::IDescriptable)
|
||||
CLASS_MEMBER_METHOD(GetParent, NO_PARAMETER);
|
||||
CLASS_MEMBER_METHOD(GetName, NO_PARAMETER);
|
||||
CLASS_MEMBER_METHOD(GetImage, NO_PARAMETER);
|
||||
CLASS_MEMBER_METHOD(GetFolders, NO_PARAMETER);
|
||||
CLASS_MEMBER_METHOD(GetContacts, NO_PARAMETER);
|
||||
CLASS_MEMBER_PROPERTY_READONLY(Parent, GetParent)
|
||||
CLASS_MEMBER_PROPERTY_READONLY(Name, GetName)
|
||||
CLASS_MEMBER_PROPERTY_READONLY(Image, GetImage)
|
||||
CLASS_MEMBER_PROPERTY_READONLY(Folders, GetFolders)
|
||||
CLASS_MEMBER_PROPERTY_READONLY(Contacts, GetContacts)
|
||||
END_CLASS_MEMBER(demo::ICategory)
|
||||
@@ -34,6 +38,12 @@ namespace vl
|
||||
BEGIN_CLASS_MEMBER(demo::IViewModel)
|
||||
CLASS_MEMBER_BASE(vl::reflection::IDescriptable)
|
||||
CLASS_MEMBER_METHOD(GetRootCategory, NO_PARAMETER);
|
||||
CLASS_MEMBER_METHOD(GetSelectedCategory, NO_PARAMETER);
|
||||
CLASS_MEMBER_METHOD(SetSelectedCategory, { L"value" });
|
||||
CLASS_MEMBER_EVENT(SelectedCategoryChanged)
|
||||
CLASS_MEMBER_METHOD(AddCategory, { L"name" });
|
||||
CLASS_MEMBER_METHOD(RemoveCategory, NO_PARAMETER);
|
||||
CLASS_MEMBER_PROPERTY_EVENT(SelectedCategory, GetSelectedCategory, SetSelectedCategory, SelectedCategoryChanged)
|
||||
END_CLASS_MEMBER(demo::IViewModel)
|
||||
|
||||
BEGIN_CLASS_MEMBER(demo::MainWindow)
|
||||
@@ -42,12 +52,10 @@ namespace vl
|
||||
|
||||
CLASS_MEMBER_GUIEVENT_HANDLER(commandBigIcon_Executed, vl::presentation::compositions::GuiEventArgs)
|
||||
CLASS_MEMBER_GUIEVENT_HANDLER(commandDeleteContact_Executed, vl::presentation::compositions::GuiEventArgs)
|
||||
CLASS_MEMBER_GUIEVENT_HANDLER(commandDeleteFolder_Executed, vl::presentation::compositions::GuiEventArgs)
|
||||
CLASS_MEMBER_GUIEVENT_HANDLER(commandDetail_Executed, vl::presentation::compositions::GuiEventArgs)
|
||||
CLASS_MEMBER_GUIEVENT_HANDLER(commandInformation_Executed, vl::presentation::compositions::GuiEventArgs)
|
||||
CLASS_MEMBER_GUIEVENT_HANDLER(commandList_Executed, vl::presentation::compositions::GuiEventArgs)
|
||||
CLASS_MEMBER_GUIEVENT_HANDLER(commandNewContact_Executed, vl::presentation::compositions::GuiEventArgs)
|
||||
CLASS_MEMBER_GUIEVENT_HANDLER(commandNewFolder_Executed, vl::presentation::compositions::GuiEventArgs)
|
||||
CLASS_MEMBER_GUIEVENT_HANDLER(commandSmallIcon_Executed, vl::presentation::compositions::GuiEventArgs)
|
||||
CLASS_MEMBER_GUIEVENT_HANDLER(commandTile_Executed, vl::presentation::compositions::GuiEventArgs)
|
||||
|
||||
|
||||
@@ -22,7 +22,9 @@ namespace demo
|
||||
class ICategory : public virtual vl::reflection::IDescriptable, public vl::reflection::Description<ICategory>
|
||||
{
|
||||
public:
|
||||
virtual demo::ICategory* GetParent() = 0;
|
||||
virtual vl::WString GetName() = 0;
|
||||
virtual vl::Ptr<vl::presentation::GuiImageData> GetImage() = 0;
|
||||
virtual vl::Ptr<vl::reflection::description::IValueObservableList> GetFolders() = 0;
|
||||
virtual vl::Ptr<vl::reflection::description::IValueObservableList> GetContacts() = 0;
|
||||
};
|
||||
@@ -31,6 +33,11 @@ namespace demo
|
||||
{
|
||||
public:
|
||||
virtual vl::Ptr<demo::ICategory> GetRootCategory() = 0;
|
||||
virtual vl::Ptr<demo::ICategory> GetSelectedCategory() = 0;
|
||||
virtual void SetSelectedCategory(vl::Ptr<demo::ICategory> value) = 0;
|
||||
vl::Event<void()> SelectedCategoryChanged;
|
||||
virtual void AddCategory(vl::WString name) = 0;
|
||||
virtual void RemoveCategory() = 0;
|
||||
};
|
||||
|
||||
template<typename TImpl>
|
||||
|
||||
@@ -20,10 +20,6 @@ namespace demo
|
||||
{
|
||||
}
|
||||
|
||||
void MainWindow::commandDeleteFolder_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
|
||||
{
|
||||
}
|
||||
|
||||
void MainWindow::commandDetail_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
|
||||
{
|
||||
}
|
||||
@@ -40,10 +36,6 @@ namespace demo
|
||||
{
|
||||
}
|
||||
|
||||
void MainWindow::commandNewFolder_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
|
||||
{
|
||||
}
|
||||
|
||||
void MainWindow::commandSmallIcon_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -22,12 +22,10 @@ namespace demo
|
||||
// #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.)
|
||||
void commandBigIcon_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments);
|
||||
void commandDeleteContact_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments);
|
||||
void commandDeleteFolder_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments);
|
||||
void commandDetail_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments);
|
||||
void commandInformation_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments);
|
||||
void commandList_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments);
|
||||
void commandNewContact_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments);
|
||||
void commandNewFolder_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments);
|
||||
void commandSmallIcon_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments);
|
||||
void commandTile_Executed(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments);
|
||||
void OnCreate();
|
||||
|
||||
Reference in New Issue
Block a user