Creating Timeline in WPF

    Since Blend is still deaf, I am doing standard things that are of no interest to anyone, then I will tell you how I am doing the Log Journal for the administrator.

    Of course, it would be possible to make a standard grid and then display this on a table, but I want something unusual and at the same time convenient. Therefore, for myself, I chose the principle of timeline.

    To get started, here are the links:
    Silverlight & WPF Timeline Control - An excellent control that I began to use (I do not like bicycles)
    Source Code - assembly sources and examples of working with it, or download library releases for Library for WPF  and  Library for Silverlight separately 


    The point is simple: we throw the DLL into the references, add new elements to our ToolBox and throw it on the form. Here is the code I got:

    1.     x:Name="LayoutRoot"
    2.     Background="White">
    3.     
    4.       
    5.         x:Name="tiTimeLine"
    6.         Header="TimeLine">
    7.         
    8.           x:Name="grdTimeLine">
    9.           
    10.             
    11.               Height="*" />
    12.             
    13.               Height="30" />
    14.           
    15.  
    16.           
    17.             x:Name="timeline"
    18.             Grid.Row="0"
    19.             CalendarType="gregorian"
    20.             HorizontalAlignment="Stretch"
    21.             MinDateTime="01/01/2010"
    22.             MaxDateTime="01/01/2020"
    23.             InitialDateTime="02/11/2010">
    24.  
    25.             
    26.               
    27.                 Height="20" />
    28.               
    29.                 Height="*" />
    30.               
    31.                 Height="25" />
    32.               
    33.                 Height="20" />
    34.             
    35.             
    36.             
    37.               Grid.Row="0"
    38.               />
    39.  
    40.             
    41.               Grid.Row="1"
    42.               IsMainBand="True"
    43.               ItemSourceType="Days"
    44.               HorizontalAlignment="Stretch"
    45.               TimelineWindowSize="20"
    46.               MaxEventHeight="130" />
    47.             
    48.             
    49.               Grid.Row="2"
    50.               HorizontalAlignment="Stretch"
    51.               ItemSourceType="months"
    52.               TimelineWindowSize="16"
    53.               MaxEventHeight="4" />
    54.             
    55.             
    56.               Grid.Row="3"
    57.               HorizontalAlignment="Stretch"
    58.               ItemSourceType="years"
    59.               TimelineWindowSize="16"
    60.               MaxEventHeight="4" />
    61.  
    62.           
    63.         
    64.       
    65.       
    66.         x:Name="tiOther"
    67.         Header="Another">
    68.         
    69.       
    70.     
    71.   
    * This source code was highlighted with Source Code Highlighter.


    And of course the picture.


    All this is dynamic and works. Well, almost everything - the deploy button in WPF does not work, because in libraries it is registered only for SIlverlight. 
    But with the addition of data, I don’t understand something, maybe one of you will understand. In the examples, data is inserted either from the server (for example: localhost : 123 / data.xml) or from resources (which for some reason does not plow).

    You can also unload from the SQL database. Now it’s very late tomorrow I will update and show how to connect the database, but in a nutshell - convert to XMLDocument.

    Also popular now: