Version | Elvis 3.3.67 |
Created on | 20.10.2016 |
Included features | Automatically open a popup on event |
Download Project
Note: Please unpack the zip file with a packing program (e.g. 7-Zip) or call up the properties of the downloaded zip file and check the “Allow” box if you are on the safe side. Otherwise the dll files will be blocked!
Task
A popup is supposed to open when the doorbell rings.
Expiration
- The popup is attached here in the title bar; In principle, everything that is always visible via PageMaster is suitable.
- The opening is done here by binding IsOpen to the doorbell data point.
- Closing via a CommandButton that triggers the Application.Close command, which closes the active popup (Properties -Action – Command->>> “Close”).
- The content of the popup is a part.
Implementation
- Create a doorbell data point with DPT BooleanCmd.
- Create part with CommandButton. In the properties of the CommandButton, select “Action” – “Command” ->> “Close”. After that, “Build Solution”.
- Open “TitelBar” in the “Master” folder and drag and drop the part onto the title bar.
- Convert part into a popup via context menu -> select “automatically close” here. Then delete the now visible “CommandButton”. Now you have to make some changes here in the code, because this cannot be set via the property field.
This is what the code looks like after deleting the CommandButton (depending on which name you have assigned for the part, it will appear here).
<Popup x:Name=”MyPopup” AllowsTransparency=”True” PopupAnimation=”Slide” Placement=”Relative” PlacementTarget=”{Binding ElementName=Part2OpenClose}” StaysOpen=”False”>
<Parts:Part x:Name=”MyPopup”/>
</Popup>
Here the riser is modified as follows!
<Popup Name=”MyPopup” PlacementTarget=”{Binding MainWindow}” Placement=”Center” IsOpen=”{Binding [Datenpunkte\Doorbell]. Value}”>
<Parts:MyPopup/>
</Popup> - After that, place the DP on one side (simulates the bell) and start the designer.
Now, when you press the bell, the popup will open.