Z
Zequion1_
Guest
The WPF forum is not like this and they do not respond the same so I stop here again.
It is impossible for me to do an Update Label from Wpf. It has never worked for me and I don't want to do something similar to a DoEvents () because I only want to update a label.
// DOEVENTS(). This always works but lowers the performance of the computer and also I just want to update Label.
System.Windows.Application.Current.Dispatcher.Invoke(new System.Action(() => { }), System.Windows.Threading.DispatcherPriority.ContextIdle, null);
// REFRESH(). UPDATE LABEL. THIS ONLY SHOW "0" IN THE LABEL.
namespace Name_Wpf_Refresh_Test
{
// -----------------------------------------
// WPF. REFRESH.
// -----------------------------------------
public static class Cls_Wpf_Refresh_Test
{ private static System.Action EmptyDelegate = delegate(){};
public static void Refresh(this System.Windows.UIElement uiElement)
{ uiElement.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Render, EmptyDelegate);
}
public static void Fcn_Refresh_Test(System.Windows.Controls.Label MyLabel)
{ for (int i = 0; i < 10; i++)
{ MyLabel.Content = i.ToString();
MyLabel.Refresh();
System.Threading.Thread.Sleep(500);
}
}
}
public class Cls_Main
{
public static void Fcn_Refresh(System.Windows.Controls.Label MyLabel)
{ Name_Wpf_Refresh_Test.Cls_Wpf_Refresh_Test.Fcn_Refresh_Test(MyLabel);
}
}
}
Continue reading...
It is impossible for me to do an Update Label from Wpf. It has never worked for me and I don't want to do something similar to a DoEvents () because I only want to update a label.
// DOEVENTS(). This always works but lowers the performance of the computer and also I just want to update Label.
System.Windows.Application.Current.Dispatcher.Invoke(new System.Action(() => { }), System.Windows.Threading.DispatcherPriority.ContextIdle, null);
// REFRESH(). UPDATE LABEL. THIS ONLY SHOW "0" IN THE LABEL.
namespace Name_Wpf_Refresh_Test
{
// -----------------------------------------
// WPF. REFRESH.
// -----------------------------------------
public static class Cls_Wpf_Refresh_Test
{ private static System.Action EmptyDelegate = delegate(){};
public static void Refresh(this System.Windows.UIElement uiElement)
{ uiElement.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Render, EmptyDelegate);
}
public static void Fcn_Refresh_Test(System.Windows.Controls.Label MyLabel)
{ for (int i = 0; i < 10; i++)
{ MyLabel.Content = i.ToString();
MyLabel.Refresh();
System.Threading.Thread.Sleep(500);
}
}
}
public class Cls_Main
{
public static void Fcn_Refresh(System.Windows.Controls.Label MyLabel)
{ Name_Wpf_Refresh_Test.Cls_Wpf_Refresh_Test.Fcn_Refresh_Test(MyLabel);
}
}
}
Continue reading...