Pages

Wednesday, April 25, 2012

Multiple Data Types On The Same DataGrid (Infragistics XamDataGrid)


Today I want to share with you some interesting stuff.
Recently my company started to work with Infragistics WPF controls.
My boss asked me to check a possibility to show in the same datagrid data of different types.
For instance we an XML with following data:
<datas xmlns="">
    <data type="Imaging">
        <title>Imaging stuff</title>                            
        <images>
            <img colour="blue" id="img1" size="122" />
            <img colour="blue" id="img2" size="122" />
            <img colour="blue" id="img3" size="122" />
        </images>
    </data>

    <data type="Encounter">
        <title>Encounter stuff</title>                            
        <parameters>
            <parameter id="qw" xx="12" yy="123" zz="1234"></parameter>
            <parameter id="qz" xx="12" yy="123" zz="1234"></parameter>
            <parameter id="qa" xx="12" yy="123" zz="1234"></parameter>
            <parameter id="qd" xx="12" yy="123" zz="1234"></parameter>
        </parameters>
    </data>
</datas>
As you can see Imaging and Encounter have different subcategories with different attributes and my objective is to show this data in the same datagrid control.

Thursday, April 5, 2012

What Is WPF


  • WPF aka Windows Presentation Foundation
  • The main purpose of WPF is to give to a programmer or designer a possibility to build rich GUI applications
  • Actually WPF came to replace WinForms
  • WPF is part of .Net Framework 3.0 or higher

Some basic stuff about WPF

  • In order to begin write your WPF application you can open Visual Studio and chose project type named "WPF Application"
  • GUI consists of two files - *.xaml and code-behind *.cs
  • XAML file is actually an XML which describes the GUI
  • One of the strongest side of WPF concept is logical separation of appearance and behavior


What you should know before starting to write your first WPF application?

  • Forget about how you wrote your WinForms applications, in WPF it is all about the bindings
  • Before you start to write your first WPF application you MUST to read about MVVM (Model-View-ViewModel pattern), believe me it`s super important
  • If you listened to my advice then your code-behind file *.cs will be almost empty, all the GUI logic is configured in *.xaml file and all GUI elements should be bonded to relevant ViewModel
  • And again NEVER write GUI logic in your code-behind file *.cs

Well that`s it for to today, gotta run, have a lot work to do.
If you have questions, please write me in comments section.
Cheers!