XAML
Here I created a listbox which is add a listitems from combobox at run time. In data template contains two textblock, one textblock display a values from combobox which is selected by the user, the other textblock used to display a hour value which is in code behind file.
code behind file(c#)
private void dispatcherTimer_Tick1(object sender, EventArgs e)
{
if (dispatcherTimer1.Interval == TimeSpan.FromSeconds(15))
{
//lstbxindex.Items.Add(lstbxindex.SelectedItem.ToString());
obj = new Roundedhour();
obj.hourvalue = Convert.ToString(hrvalueinitially);
this.ItemsSource = obj;
//this.DataContext = this;
//lblprojectAhr.Content = string.Join(",", hrvalueinitially + "" + "hr");
}
{
if (dispatcherTimer1.Interval == TimeSpan.FromSeconds(15))
{
//lstbxindex.Items.Add(lstbxindex.SelectedItem.ToString());
// string hourvalue = Convert.ToString(hrvalueinitially);
obj = new Roundedhour();
obj.hourvalue = Convert.ToString(hrvalueinitially);
roundedhourvalue = obj.hourvalue;
this.ItemsSource = obj;
//this.DataContext = this;
//lblprojectAhr.Content = string.Join(",", hrvalueinitially + "" + "hr");
}
}
Roudedhour.cs(c#)
public class Roundedhour
{
public string hourvalue { get; set; }
}
}
{
public string hourvalue { get; set; }
public override string ToString()
{
return string.Format("{0}", hourvalue);
}
{
return string.Format("{0}", hourvalue);
}
}
}

Logeswari JegatheesanPosted Feb 3, 2017, 6:32 AM
Rafnas T PPosted Feb 3, 2017, 4:11 AM
{
public string roundedhourvalue
{
get
{
return var_roundedhourvalue;
}
set
{
var_roundedhourvalue = value;
}
}
}
Logeswari JegatheesanPosted Feb 3, 2017, 2:24 AM
Rafnas T PPosted Feb 3, 2017, 1:57 AM
{
if (dispatcherTimer1.Interval == TimeSpan.FromSeconds(15))
{
{
roundedhourvalue=Convert.ToString(hrvalueinitially);
});
{
public string roundedhourvalue{ get; set; }
{
return string.Format("{0}", hourvalue);
}
}
}
Logeswari JegatheesanPosted Feb 3, 2017, 1:06 AM
{
public string Hourvalue { get; set; }
{
return string.Format("{0}", Hourvalue);
}
}
{
get { return Hourvalue; }
set { Hourvalue = value; }
}
/// Every 15mintues it will show the rounded hour
///
///
///
///
private void dispatcherTimer_Tick1(object sender, EventArgs e)
{
if (dispatcherTimer1.Interval == TimeSpan.FromSeconds(15))
{
obj = new Roundedhour();
obj.Hourvalue = Convert.ToString(hrvalueinitially);
roundedhourvalue = obj.Hourvalue;
this.DataContext = obj;
}
double hrvalueinitially;
/// check the condition the item is selected in listbox or not
/// if it is selected, start count the timing
/// Every 8 mintues hour value increment 0.25
/// Check the selected projectName Changed or Not
/// if it changed previous selected projectName their Mintues values stored into the databaseTable.(storedMin() Method)
///
///
///
private void dispatcherTimer_Tick(object sender, EventArgs e)
{
int value = lstbxindex.SelectedIndex;
//check the listbox items is selected or not
if (lstbxindex.SelectedIndex > -1)
{
if (dispatcherTimer.Interval == TimeSpan.FromSeconds(3))
{
//double hourval = hrvalue;
hrvalueinitially = hrvalue;
}
Asish MohapatraPosted Feb 2, 2017, 12:54 PM