Data/Code driven UI with WPF part 1

Slides:



Advertisements
Similar presentations
Win8 on Intel Programming Course Desktop : WPF Cédric Andreolli Intel Software
Advertisements

Windows Presetation Foundation (WPF) 1. Introduction.
A Good UX How To Make It Happen EAE 4023, UNITE 2010 Tuesday, 9:15 am May 25 th 2010 Niels Gebauer Director Client Tools Consultancy
WPF For PowerBuilder Developers
CST238 Week 7 Questions / Concerns? Announcements – HW#2 due today (project concept/preliminary design) – Check-off Take Home lab#6 Friday is the last.
A Jumpstart to WPF by Kevin Grossnicklaus ArchitectNow.
1 Intro XAML Attribute syntax & property syntax Panels Reusable resources Controls Data binding Steen Jensen, spring 2014.
Windows Presentation Foundation. Agenda Introduction Developing Applications WPF and WF interoperability Custom Controls Styles and Templates Data Binding.
Smart Client for Smart Devices Niels Gebauer Director Client Tools Consultancy  The slides contain brief notes  Some slides.
Getting Started with Caliburn.Micro and Windows Phone 7 Gary Ewan Park Twitter: Blog:
WEB DESIGN AND PROGRAMMING Advanced CSS Techniques.
Object Oriented Software Development 9. Creating Graphical User Interfaces.
Are you getting the benefits from ASP.NET and AJAX? Introduction to the CTC ASP.NET Webforms Generator.
Introduction to Flash Animation CS 318. Topics Introduction to Flash and animation The Flash development environment Creating Flash animations  Layers.
Discover, Master, Influence1 Windows Presentation Foundation David Burela Senior Developer, Readify.
Making Python Pretty!. How to Use This Presentation… Download a copy of this presentation to your ‘Computing’ folder. Follow the code examples, and put.
Rujchai Ung-arunyawee Department of Computer Engineering Khon Kaen University.
Platform abstractionSeparate UI and logic.
Positioning Objects with CSS and Tables
Model View ViewModel Architecture. MVVM Architecture components.
I/O Software CS 537 – Introduction to Operating Systems.
Adam Schultz MVVM and WPF. MVVM Model, View, ViewModel A software architecture designed to separate out User Interface design, Business Logic, and Data.
N5 Databases Notes Information Systems Design & Development: Structures and links.
Using FlexTraining.
JavaScript: API’s, Parameters and Creating Functions with Parameters
Template for a 48” x 36” Poster Presentation with a 2” Margin
FOP: Multi-Screen Apps
Core ELN Training: Office Web Apps (OWA)
Behrouz A. Forouzan TCP/IP Protocol Suite, 3rd Ed.
AP CSP: Cleaning Data & Creating Summary Tables
Imaging and Design for Online Environment
Template for a 52” x 42” Poster Presentation with a 2” Margin
Nonogram Solver Cs491b Software Design Prepared by :
GO! with Microsoft Office 2016
While multiplying larger numbers involves more steps, it’s not necessarily more challenging. If you know the steps to organize the process. So, what strategies.
Introduction to Microsoft Access
By Dr. Madhukar H. Dalvi Nagindas Khandwala college
Tables and Frames.
Tutorial 6 Topic: jQuery and jQuery Mobile Li Xu
GO! with Microsoft Access 2016
Arrays and files BIS1523 – Lecture 15.
A Possible Future Device
Cover Letters: Selling your skills on paper

MonoGame and Windows 8.
How Data Flows through the Internet
WPF AKEEL AHMED.
Creating and Modifying Queries
File Handling Programming Guides.
Cover Letters: Selling your skills on paper
Resources & Controls AKEEL AHMED.
Matlab tutorial course
Jordan Knight Solution Architect - Xamling
Responsive Grid Layout with Bootstrap
Whatcha doin'? Aims: Begin to create GUI applications. Objectives:
SEEM4570 Tutorial 5: jQuery + jQuery Mobile
Cover Letters: Selling your skills on paper
GRAPHICAL USER INTERFACE GITAM GADTAULA. OVERVIEW What is Human Computer Interface (User Interface) principles of user interface design What makes a good.
GRAPHICAL USER INTERFACE GITAM GADTAULA KATHMANDU UNIVERSITY CLASS PRESENTATION.
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Monitoring Test Progress and Data Cleanup
The poster title goes here and here
What do I do when I’m done reading a text?
Unit J: Creating a Database
Primary School Computing
Data/Code driven UI using WPF part 2
An Introduction to the Model-View-ViewModel Pattern
Brown Bag Seminar Summer 2007
Presentation transcript:

Data/Code driven UI with WPF part 1 How can WPF GUIs be built without XAML? Wolfgang Riedmann wolfgang@riedmann.it Xbase.Future 2018 in Köln

Disclaimer What you will not see in this session: The absolute truth The best or the only solution 100% error free and perfectly written code What you will see instead: Another (and not commonly used) possibility to build WPF GUIs A solution to build windows and UserControls dynamically A possible solution for multilanguage applications Graphical design without using stylesheets, possible also on an individual base Hopefully a better understanding how WPF works internally Xbase.Future 2018 in Köln

Why WPF and not WinForms Futureproof: WPF is a completely new designed GUI plattform that is not tight to the Windows GUI. If Microsoft will write a platform independent GUI library, then it will be a descendant to WPF WPF is completely vector oriented and scales from low resolutions on cheap tablets until high resolution devices like 4K monitors The design of WPF permits nearly unlimited possibilities to build complex UserControls simply assembling them from the base controls WPF is highly dynamic – windows and controls should not be positioned by specifying coordinates, but by using content controls like panels or grids WPF has a very powerful databinding and is very well suited for MVVM applications Xbase.Future 2018 in Köln

What is different in WPF The VO-GUI-Klassen are using coordinates like WinForms and the entire Windows GDI. WPF works like HTML with content controls and distances. It is possible to use WPF als with coordinates (using the CanvasControl), but you will loose the biggest advantage of WPF – the dynamic positioning To build a WPF windows successfully, as first thing you should think how this window should adapt itself to different screen sizes. Only if you are sure about this you should start to work. Only if you respect this your result will work well on very different screen sizes and resolutions. Xbase.Future 2018 in Köln

Our target A simple window, with databinding to a ViewModel for data and actions (Commands) Xbase.Future 2018 in Köln

The first try: XAML Xbase.Future 2018 in Köln XAML: I don‘t like that parameters as „Margin“ and „Height“ are defined many times. The databinding is specified in a complex manner, and I‘m missing the possility for multilingual GUIs. Both the captions and the measures can be defined also by databinding, but this makes the code even more complex and less readable. Xbase.Future 2018 in Köln

The second try: Code Xbase.Future 2018 in Köln If we write the window using code we have some advantages: we see immediatly how many rows and columns we have, and margins and heights are defined only once. The code may be look a bit cleaner, but is is much more. We can build it completely in XIDE, but we miss also a preview. Xbase.Future 2018 in Köln

3rd try: Own control classes We have learned something using VO: don‘t duplicate code, but put it in own classes. As sample you can see the WPFTextBox. The Clou: we copy the name based binding from VO. Automatically the content of the control will be coupled with a field with the same name in the model. All this is done in the Name property. And se set the margin and the height to the applicationwide values. Xbase.Future 2018 in Köln

3rd try: The window Xbase.Future 2018 in Köln Finally we have clean and readable code without loosing functionality! Xbase.Future 2018 in Köln

Idea: build a windows dynamically Using the control classes from the previous sample we can build our window completely dynamic – and we have been arrived at our target. Define your data structure and the window will build itself as needed. Xbase.Future 2018 in Köln

And DBF? Xbase.Future 2018 in Köln Sometimes at this moment people asks: and with DBF data? My answer: of course, because with the WPF Databinding it is completely irrelevant where the data comes from. To make this in a dynamic way, we need a special class that permits dynamic properties. In some of my VO applications I have data from different data sources in a single window, and with WPF this is also possible, maybe a bit easier Xbase.Future 2018 in Köln

The DataGrid – first in XAML The DataGrid in its simpliest form does not need any configuration – it displays all columns of the associated datasource. But if you need to specify the columns manually, you need to do this in XAML. This is the main problem in my eyes because it is not possible to configure the columns with databinding. Xbase.Future 2018 in Köln

The DataGrid –in Code Xbase.Future 2018 in Köln Written in code there is more code and the code is less readable than XAML. But is more flexible because the columns can be added depending onm some conditions or in a loop. Xbase.Future 2018 in Köln

The DataGrid – with an own class This is much more readable and cleaner code. Xbase.Future 2018 in Köln

The DataGrid – and with DBF? For the DBF access we use our ExpandoObject class from one of the previous samples Xbase.Future 2018 in Köln

Finished – Thank you for your attention! I hope you have learned something from this session – even if you think: never ever I will do something like that! Xbase.Future 2018 in Köln