Noesis::TimeSpan has no properties?
Using Noesis::TimeSpan instead of the WPF/C# Timespan that works in my mock project, with the following binding
It works in C#/Blend, but in C++ using Noesis::TimeSpan I get
Is there a workaround/have I misunderstood something?
Thanks!
Code: Select all
<MultiBinding StringFormat="{}+{0:00}:{1:00}:{2:00;00}" FallbackValue="+00:00:13">
<Binding Path="HoveredTimeDifference.Hours" />
<Binding Path="HoveredTimeDifference.Minutes" />
<Binding Path="HoveredTimeDifference.Seconds" />
</MultiBinding>
Code: Select all
Type 'TimeSpan' does not contain a property named 'Seconds'
Type 'TimeSpan' does not contain a property named 'Minutes'
Type 'TimeSpan' does not contain a property named 'Hours'
Thanks!
Re: Noesis::TimeSpan has no properties?
Here is my workaround
I can now use the same XAML with Blend and Noesis C++. Not sure of the implications but for my use-case it seems to be enough!
Code: Select all
#include "NsApp/NotifyPropertyChangedBase.h"
#include "NsCore/ReflectionImplement.h"
#include "NsGui/TimeSpan.h"
class ExposedTimeSpan
{
public:
ExposedTimeSpan() = default;
ExposedTimeSpan(float seconds)
: timeSpan_(seconds) {}
~ExposedTimeSpan() = default;
ExposedTimeSpan(const ExposedTimeSpan&) = default;
ExposedTimeSpan(ExposedTimeSpan&&) = default;
ExposedTimeSpan& operator=(const ExposedTimeSpan&) = default;
ExposedTimeSpan& operator=(ExposedTimeSpan&&) = default;
/// Returns a string that represents the current object
Noesis::String ToString() const {
return Noesis::String("ExposedTimeSpan");
}
int GetSeconds() const {
return timeSpan_.GetSeconds();
}
int GetMinutes() const {
return timeSpan_.GetMinutes();
}
int GetHours() const {
return timeSpan_.GetHours();
}
double GetTimeInSeconds() const {
return timeSpan_.GetTimeInSeconds();
}
bool operator==(const ExposedTimeSpan& rhs) const {
return timeSpan_.GetTicks() == rhs.timeSpan_.GetTicks();
}
NS_IMPLEMENT_INLINE_REFLECTION(ExposedTimeSpan, Noesis::NoParent, "ExposedTimeSpan")
{
NsProp("Seconds", &ExposedTimeSpan::GetSeconds);
NsProp("Minutes", &ExposedTimeSpan::GetMinutes);
NsProp("Hours", &ExposedTimeSpan::GetHours);
}
private:
Noesis::TimeSpan timeSpan_;
};
Re: Noesis::TimeSpan has no properties?
This was fixed in #2657. Could you try the latest 3.2.2 to verify?
Who is online
Users browsing this forum: No registered users and 5 guests