C++ How to properly cast PropertyChangedEventArgs.newValue
Posted: 14 Jun 2016, 09:59
As the OnPropertyChanged(DependencyPropertyChangedEventArgs& arg) arg.newValue is a const void pointer, and I don't know what type it is when the property is ForegroundProperty, I can't clone it and set it as a new foreground. How do I fix this:
Can the "GetType" sort of functions be leveraged in a future situations to find out what type the most derived class is, since the document is lacking in this front?
Code: Select all
if (e.prop == ForegroundProperty)
{
//Brush* brush = (Brush*)((Brush*)arg.newValue)->Clone().GetPtr();
ButtonControl->SetForeground((Brush*)arg.newValue);
}