CN115981624A - WPF-based drop-down box control element screening method and server - Google Patents

WPF-based drop-down box control element screening method and server Download PDF

Info

Publication number
CN115981624A
CN115981624A CN202211677453.9A CN202211677453A CN115981624A CN 115981624 A CN115981624 A CN 115981624A CN 202211677453 A CN202211677453 A CN 202211677453A CN 115981624 A CN115981624 A CN 115981624A
Authority
CN
China
Prior art keywords
drop
down box
wpf
array
screening
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211677453.9A
Other languages
Chinese (zh)
Inventor
何正鹏
程显超
余吉昌
张常华
朱正辉
赵定金
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Baolun Electronics Co ltd
Original Assignee
Guangdong Baolun Electronics Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Baolun Electronics Co ltd filed Critical Guangdong Baolun Electronics Co ltd
Priority to CN202211677453.9A priority Critical patent/CN115981624A/en
Publication of CN115981624A publication Critical patent/CN115981624A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Programmable Controllers (AREA)

Abstract

The invention discloses a WPF-based drop-down box control element screening method and a server, wherein the method comprises the following steps of: s1: creating a user control UserControl, and creating a Button in the user control UserControl; s2: placing an item control ItemsControl in the Button, and popping up a drop-down box outwards when acquiring an external instruction; s3: setting a dependency attribute in a data source of the drop-down box, assigning an array to the dependency attribute, and screening elements, thereby hiding elements selected by other drop-down boxes in the drop-down box of the WPF, only keeping the elements selected by the current drop-down box and elements not selected by other drop-down boxes, and achieving the purpose of self-defining the drop-down box control of the WPF.

Description

WPF-based drop-down box control element screening method and server
Technical Field
The invention relates to the technical field of WPF controls, in particular to a method and a server for screening elements of a pull-down box control based on WPF.
Background
WPF, collectively referred to as: windows Presentation Foundation, which belongs to a Windows-based user interface Framework, is a part of NET Framework 3.0. The method provides a uniform programming model, language and framework, really performs the work of separating interface designers and developers, and provides a brand-new multimedia interaction user graphical interface.
However, when a plurality of pull-down boxes in the WPF share the same set of data, the data often appears repeatedly in other pull-down boxes after being selected in a certain pull-down box, and the requirement that the same data can only be selected once when the pull-down boxes are used cannot be met, which brings obvious trouble to the work of designers and developers.
Disclosure of Invention
In order to overcome the defects of the prior art, an object of the present invention is to provide a method for screening elements of a pull-down box control based on WPF, which can solve the problem that when a plurality of pull-down boxes in the existing WPF share the same set of data, the data is still repeatedly appeared in other pull-down boxes after being selected.
The invention also aims to provide a WPF-based drop-down box control element screening server, which can solve the problem that when a plurality of drop-down boxes in the existing WPF share the same group of data, the data can still repeatedly appear in other drop-down boxes after being selected.
In order to achieve one of the purposes, the technical scheme adopted by the invention is as follows:
a WPF-based drop-down box control element screening method comprises the following steps:
s1: creating a user control UserControl, and creating a Button in the user control UserControl;
s2: placing an item control ItemsControl in the Button, and popping up a drop-down box outwards when acquiring an external instruction;
s3: and setting a dependent attribute in a data source of the drop-down box, assigning an array to the dependent attribute, and screening elements.
Preferably, the step S3 is specifically realized by the following steps:
s31: traversing the dependency attribute arrays of all the drop-down boxes, screening all the elements marked as selected, and storing the id of the selected element in the integer array A;
s32: traversing a dependency attribute array in a drop-down box corresponding to the current external instruction, screening out elements marked as selected in the drop-down box, and storing the id of the selected elements in an integer array B;
s33: removing the data of the integer array A from a drop-down frame corresponding to the current external instruction according to the id of the element, and simultaneously reserving the data of the integer array B to generate an array C;
s34: and assigning the array C to a data source of a drop-down box corresponding to the current external instruction.
In order to achieve the second purpose, the technical scheme adopted by the invention is as follows:
a WPF-based drop-down box control element screening server comprises a storage and a processor;
a memory for storing program instructions;
a processor configured to execute the program instructions to perform the WPF-based drop-down box control element screening method as described above.
Compared with the prior art, the invention has the beneficial effects that: the method comprises the steps of creating a user control UserControl, creating a Button in the user control UserControl, simultaneously placing an entry control ItemsControl in the Button, popping up a drop-down frame when an external instruction is obtained, then setting a dependent attribute in a data source of the drop-down frame, assigning an array to the dependent attribute, and screening elements, so that elements selected by other drop-down frames are hidden in the drop-down frame of the WPF, only the elements selected by the current drop-down frame and unselected by other drop-down frames are reserved, and the purpose of self-defining the drop-down frame control of the WPF is achieved.
Drawings
Fig. 1 is a flowchart of a method for screening elements of a pull-down box control based on WPF according to the present invention.
Fig. 2 is a schematic diagram of an actual application of the method for screening elements of a pull-down box control based on WPF in the present invention.
Detailed Description
The preferred embodiments of the present invention will be described in conjunction with the accompanying drawings, and it should be understood that they are presented herein only to illustrate and explain the present invention and not to limit the present invention.
In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In the description of the present invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
The invention will be further described with reference to the accompanying drawings and the detailed description below:
the first embodiment is as follows:
as shown in fig. 1-2, a method for screening elements of a pull-down box control based on WPF includes the following steps:
s1: creating a user control UserControl, and creating a Button in the user control UserControl;
specifically, a blank user control UserControl is created, at least one Button is created in the user control UserControl, and the style of the Button is set;
s2: placing an item control ItemsControl in the Button, and popping up a drop-down box outwards when acquiring an external instruction;
specifically, an item control ItemsControl is placed in the Button, and a drop-down box pops up when an external instruction is acquired, preferably, the drop-down box pops up when the Button is clicked each time
S3: and setting a dependent attribute in a data source of the drop-down box, assigning an array to the dependent attribute, and screening elements.
Specifically, a dependent attribute is set for a data source of the drop-down box, and when the drop-down box is used, work can be started only by assigning an array to the dependent attribute. In this embodiment, the S3 is specifically implemented by the following steps:
s31: traversing the dependency attribute arrays of all the drop-down boxes, screening out all the elements marked as selected, and storing the id of the selected element in the integer array A;
specifically, the dependency attribute arrays of the drop-down frames corresponding to all buttons in the user control UserControl are obtained, all elements marked as selected are screened out, and the id of the selected element is stored in an integer array A recording all the selected elements.
S32: traversing a dependency attribute array in a drop-down box corresponding to the current external instruction, screening out elements marked as selected in the drop-down box, and storing the id of the selected elements in an integer array B;
specifically, according to an external instruction, traversing the dependent attribute array in the drop-down frame corresponding to the external instruction, screening the element marked as selected in the drop-down frame, and storing the id of the selected element in the integer array B, for example, a user clicks the Button1 through a peripheral device (keyboard and mouse device, touch screen, etc.), that is, traversing the dependent attribute array in the drop-down frame 1 corresponding to the Button1, screening the element marked as selected in the drop-down frame 1, and storing the id of the selected element in the integer array B selected in the drop-down frame in a current column.
S33: removing the data of the integer array A from a drop-down frame corresponding to the current external instruction according to the id of the element, and simultaneously reserving the data of the integer array B to generate an array C;
specifically, when the data of the drop-down frame is displayed, the data of the integer array A is removed from the current drop-down frame according to the id stored in the integer array A, and meanwhile, the data of the integer array B is reserved in the current drop-down frame according to the id stored in the integer array B, so that an array C is generated.
S34: and assigning the array C to a data source of a drop-down box corresponding to the current external instruction.
Specifically, the array C is assigned to the data source of the drop-down box corresponding to the current external instruction, so that elements selected by other drop-down boxes are hidden in the drop-down box of the WPF, only the elements selected by the current drop-down box and the unselected elements of other drop-down boxes are reserved, and the purpose of self-defining the drop-down box control of the WPF is achieved
In the present embodiment, as shown in fig. 2, it is set that there is A, B, C, D as the original data, and the original data A, B, C and D are bound to the dependent attributes of each drop-down box (drop-down box 1, drop-down box 2, and drop-down box 3), where data a is selected in the drop-down box 1, data C is not selected in the drop-down box 2, and after data screening is performed on the dependent attributes by the drop-down box control element screening server based on WPF, data A, B, D is displayed in the drop-down box 1, data B, D is displayed in the drop-down box 2, and data B, C, D is displayed in the drop-down box 3.
Example two:
the utility model provides a drop-down box control element screening server based on WPF which characterized in that: comprises a storage and a processor;
a memory for storing program instructions;
a processor, configured to execute the program instructions to perform the WPF-based drop-down box control element screening method as described in embodiment one.
In the present embodiment, as shown in fig. 2, it is set that there is A, B, C, D as the original data, and the original data A, B, C and D are bound to the dependent attributes of each drop-down box (drop-down box 1, drop-down box 2, and drop-down box 3), where data a is selected in the drop-down box 1, data C is not selected in the drop-down box 2, and after data screening is performed on the dependent attributes by the drop-down box control element screening server based on WPF, data A, B, D is displayed in the drop-down box 1, data B, D is displayed in the drop-down box 2, and data B, C, D is displayed in the drop-down box 3.
Various other modifications and changes may be made by those skilled in the art based on the above-described technical solutions and concepts, and all such modifications and changes should fall within the scope of the claims of the present invention.

Claims (3)

1. A method for screening elements of a drop-down box control based on WPF (Windows presentation Foundation) is characterized by comprising the following steps:
s1: creating a user control UserControl, and creating a Button in the user control UserControl;
s2: an item control ItemsControl is placed in the Button, and a drop-down box pops outwards when an external instruction is obtained;
s3: and setting a dependent attribute in a data source of the drop-down box, assigning an array to the dependent attribute, and screening elements.
2. The WPF-based drop-down box control element screening method according to claim 1, wherein the S3 is specifically implemented by the following steps:
s31: traversing the dependency attribute arrays of all the drop-down boxes, screening out all the elements marked as selected, and storing the id of the selected element in the integer array A;
s32: traversing a dependency attribute array in a drop-down box corresponding to the current external instruction, screening out elements marked as selected in the drop-down box, and storing the id of the selected elements in an integer array B;
s33: removing the data of the integer array A from a drop-down frame corresponding to the current external instruction according to the id of the element, and simultaneously reserving the data of the integer array B to generate an array C;
s34: and assigning the array C to a data source of a drop-down box corresponding to the current external instruction.
3. The utility model provides a drop-down box control element screening server based on WPF which characterized in that: comprises a storage and a processor;
a memory for storing program instructions;
a processor for executing the program instructions to perform the WPF-based drop-down box control element screening method of any one of claims 1-2.
CN202211677453.9A 2022-12-26 2022-12-26 WPF-based drop-down box control element screening method and server Pending CN115981624A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211677453.9A CN115981624A (en) 2022-12-26 2022-12-26 WPF-based drop-down box control element screening method and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211677453.9A CN115981624A (en) 2022-12-26 2022-12-26 WPF-based drop-down box control element screening method and server

Publications (1)

Publication Number Publication Date
CN115981624A true CN115981624A (en) 2023-04-18

Family

ID=85966187

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211677453.9A Pending CN115981624A (en) 2022-12-26 2022-12-26 WPF-based drop-down box control element screening method and server

Country Status (1)

Country Link
CN (1) CN115981624A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040128309A1 (en) * 2002-12-31 2004-07-01 International Business Machines Corporation Edit selection control
CN108038142A (en) * 2017-11-24 2018-05-15 平安科技(深圳)有限公司 Realize method, electronic device and the storage medium of multistage linking combobox
CN110377851A (en) * 2019-06-18 2019-10-25 平安科技(深圳)有限公司 Implementation method, device and the computer equipment of multistage linking combobox
CN114265536A (en) * 2021-12-21 2022-04-01 广州市保伦电子有限公司 WPF-based arc-shaped sliding control design method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040128309A1 (en) * 2002-12-31 2004-07-01 International Business Machines Corporation Edit selection control
CN108038142A (en) * 2017-11-24 2018-05-15 平安科技(深圳)有限公司 Realize method, electronic device and the storage medium of multistage linking combobox
CN110377851A (en) * 2019-06-18 2019-10-25 平安科技(深圳)有限公司 Implementation method, device and the computer equipment of multistage linking combobox
CN114265536A (en) * 2021-12-21 2022-04-01 广州市保伦电子有限公司 WPF-based arc-shaped sliding control design method

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
&不羁之风&: "多个select下拉框,选中当前某一项,其他下拉框去掉选中的值", pages 1 - 2, Retrieved from the Internet <URL:https://blog.csdn.net/weixin_44538423/article/details/88252626> *
CODE BEAN: "【wpf】实战 ItemsControl + 用户控件 + 绑定", pages 1 - 4, Retrieved from the Internet <URL:https://blog.csdn.net/songhuangong123/article/details/126319542> *
WEIXIN_30756499: "多选Combobox的实现", pages 1 - 2, Retrieved from the Internet <URL:https://blog.csdn.net/weixin_30756499/article/details/98055363> *
廿二又: "实现多个下拉框同一批option, 选中其一其他框里去除选中的项(不可选择已选过的项)", pages 1 - 3, Retrieved from the Internet <URL:https://blog.csdn.net/u014596302/article/details/51917937> *

Similar Documents

Publication Publication Date Title
US9183561B2 (en) Automatic generation of trend charts
US8881105B2 (en) Test case manager
US6826443B2 (en) Systems and methods for managing interaction with a presentation of a tree structure in a graphical user interface
CN103729285B (en) A kind of webpage test method, equipment and system
US9524525B2 (en) Method, system, and graphical user interface for presenting an interactive hierarchy and indicating entry of information therein
US8229576B2 (en) Field device management apparatus and field device management system
CN107122301A (en) Interface detection method and device
CN109302522A (en) Test method, device and computer system and medium
CN110045894A (en) System and method for dialog box customization
US20150089403A1 (en) Dynamic generation of user interface
US9098638B2 (en) System and method for automatic test level generation
CN106354483B (en) Data processing method and device and electronic equipment
CN107480369B (en) Design and operation method for classified display of DRC in PCB design
US8205160B2 (en) Graphical user interface for multi-frame presentation
CN111510749A (en) Method and device for displaying EPG (electronic program guide) page
TW200406692A (en) Semiconductor test data analysis system
EP2388690B1 (en) Method and apparatus for displaying batch execution data of an industrial plant
CN112035555B (en) Information display method, device and equipment
CN115981624A (en) WPF-based drop-down box control element screening method and server
US20200327125A1 (en) Systems and methods for hierarchical process mining
US9082104B2 (en) Method and apparatus for managing system specifications
KR101989634B1 (en) Creating logic using pre-built controls
US7461340B1 (en) Integrated decorative panels
JP2009223568A (en) Scenario-generating device and program
CN109558319A (en) Test method, equipment and the storage medium of Web page control

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20230418