Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WPF wpftoolkit
I have a data grid & a Listview.
The datagrid displays a table from a database vertically.
and I have added a listview that shows the status of the servers.
 
Now I have to added a new column called Delta which should display the difference between the Average column 108 & 121 from the datagrid.
 
the datagrid gets the data from DB using sql connectionstring & I used
for rotating the datagrid vertically.
&
 
Since I cant upload an image here, I will type the skeleton how my datagrid and listview looks like :
 
datagrid
Header          | Value1       |Value2
TimeoutSeconnd |     120      |   120
Position Type  |     Primary  |   Primary
Average        |     108      |   121
 
listview
Server | Role | ConnectionStatus | Delta
Test_server1 | Primary | Running | ??
 
I have created the listview using ObservableCollection as follows:
     private ObservableCollection<serverData> _ServerCollection = new   ObservableCollection<serverData>();
  public ObservableCollection<serverData> serverCollection
    { get{ return _ServerCollection; } }
 
    public class serverData
    {   public string ServerID { get; set; }
        public string Role { get; set; }
        public string ConnectionStatus { get; set; }
        public string Delta { get; set; }
    }
at XAML

    <ListView Height="auto" Name="listView1" Width="auto"   ItemsSource="{Binding ElementName=Page1,Path=serverCollection}">
         <ListView.View>
          <GridView>
          <GridViewColumn DisplayMemberBinding="{Binding ServerID}" />
          <GridViewColumn DisplayMemberBinding="{Binding Role}" />
          <GridViewColumn DisplayMemberBinding="{Binding ConnectionStatus}" />
          <GridViewColumn DisplayMemberBinding="{Binding Delta}" />
         </GridView>
        </ListView.View>
      </ListView>
 
How to achieve the difference calculation from the datagrid and displaying in the listview?!
Kindly help.. I would be grateful.. Thanks ..
Posted 3-Jan-13 13:39pm
Edited 3-Jan-13 13:44pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Mathew Soji 274
1 BillWoodruff 270
2 Afzaal Ahmad Zeeshan 244
3 Sergey Alexandrovich Kryukov 240
4 Raul Iloc 160
0 OriginalGriff 6,219
1 Sergey Alexandrovich Kryukov 5,853
2 DamithSL 5,103
3 Manas Bhardwaj 4,549
4 Maciej Los 3,845


Advertise | Privacy | Mobile
Web04 | 2.8.1411019.1 | Last Updated 3 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100