This is a real newbie question. I feel dumb that I have not figured it out yet. I am trying to add a sort to my CollectionViewSource in my Win 8 App.
<CollectionViewSource
x:Name="itemsViewSource"
x:Key="cvs"
Source="{Binding Items}">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="PubDate" Direction="Ascending"/>
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
I have the following namespaces declared:
xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
xmlns:dat="clr-namespace:System.Windows.Data;assembly=PresentationFramework"
But I get the error "Unknown member 'SortDescriptions' on element 'CollectionViewSource'" when I try to build. What am I missing?
I believe that CollecitonViewSource in WinRT does not have SortDescription. You may have to order the Items instead.
This link might help as well.
A WinRT CollectionView class with Filtering and Sorting
Related
I've been receiving a strange error after hot-reloading my code:
Logs (I'll provide them in text form if needed)
The error references a Notice Range Sphere component. It's just a UDetectionSphere, a simple wrapper for USphereComponent. It used to work correctly, I think the problems begun when I re-parented BaseEnemy from ACharacter to ABaseEntity (see class graph). The game seems to work fine, but the fact that there is an error can't be a good thing. I also can't edit component's properties in editor (both for notice and forget range spheres and for some reason arrow component inherited from ACharacter). Again, it used to work correctly and I was able to edit it. Here's how those components are declared (BaseEnemy.h):
public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Setup")
UDetectionSphere * NoticeRangeSphere;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Setup")
UDetectionSphere * ForgetRangeSphere;
I'm pretty sure the error in logs is a simple fix, but I don't even know where to start looking. I can't find this error in google, so it's probably something trivial I'm overlooking. How do I go about fixing this?
I have code using AutoMapper 3.2.1.0 that uses the method ToNullSafeString().
I upgraded the NUGet package to 4.1.1.0, and I can no longer find the method in their package.Does anyone know the recommended approach to replacing the function? Is there a new construct that is functionally equivalent? If so, I cannot figure what it is. Nor can I find any mention of why it was removed.
This question has actually been answered pretty well in a couple of comments below it. For completeness, here are a couple of actual implementations of solutions.
Short answer
Probably both the simplest and the best solution: Replace all instances of .ToNullSafeString() with ?.ToString(). This does the same, but uses functionality built into newer versions of .Net instead of relying on an external extension method.
Alternative answer
If you've got a bunch of calls to the ToNullSafeString() method from the earlier version Automapper, and for some reason or other you can't or don't want to go through all your code and edit it away right now, you can use this instead.
Add the following class to your project, and make sure it can be reached from any classes that previously called the Automapper-method. Those calls will then automatically point to this instead.
public static class NullSafeStringHelper
{
public static string ToNullSafeString(this object value)
{
return value?.ToString();
}
}
I have basically the same question as the one I asked here. Adding the using Xceed.Wpf.Toolkit.PropertyGrid.Attributes directive solved that.
This time, the compiler does not like [Category("Shipping")] decoration.
[Category("Shipping")]
public string ShipAddress { get; set; }
How can I deduce or determine what namespace needs to be included when I run into obstacles like this?
Here are the using directives I've included already:
using Xceed.Wpf.Toolkit.PropertyGrid;
using Xceed.Wpf.Toolkit.PropertyGrid.Editors;
using Xceed.Wpf.Toolkit.PropertyGrid.Commands;
using Xceed.Wpf.Toolkit.PropertyGrid.Converters;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
The xaml is this:
<xctk:PropertyGrid AutoGenerateProperties="True" Name="XPG1" IsCategorized="True" />
I know this is an older question, but since it's unanswered I thought it would be helpful to provide one anyway. In this case you need the following using statement:
using System.ComponentModel;
In general, the best way to figure out what namespace or using statement you need is to look for the name of the attribute in the Object Browser under the Xceed namespace, and if you can't find it there, on Google.
One thing to remember - while it shows up as just [Category] in code, the actual name of the class will be CategoryAttribute.
I'm creating an application that uses JavaFX 2.2 and have run into a problem. I'm trying to use a LineChartBuilder, like so:
LineChart<Number, Number> chart = LineChartBuilder.<Number, Number>
create()
.XAxis(NumberAxisBuilder.create().label("X axis").build())
.YAxis(NumberAxisBuilder.create().label("Y axis").build())
.build();
However, I'm getting the following compiler errors:
java: reference to create is ambiguous, both method create() in
javafx.scene.layout.RegionBuilder and method <X,Y>create() in
javafx.scene.chart.LineChartBuilder match
and
java: cannot find symbol
symbol: method XAxis(javafx.scene.chart.NumberAxis)
location: class javafx.scene.layout.RegionBuilder<capture#1 of ?>
I know the first error means LineChartBuilder descends from RegionBuilder and both define a create() method, and the second means it's assuming the method comes from RegionBuilder and therefore cannot find the XAxis method. I've even tried casting it,
LineChart<Number, Number> chart =
((LineChartBuilder<Number, Number, ?>)
LineChartBuilder.<Number, Number>create())....
But I get the same compiler errors.
My question is, is this a mistake in LineChartBuilder or am I using it wrong? Maybe there's even a workaround?
Are you sure you are running with JavaFX 2.2 and not a JDK8 pre-release?
JDK8 will experience these issues with builders coded for JavaFX 2.2: see RT-24272.
Workaround is to use new LineChart(xaxis, yaxis). See also the Oracle forum thread post on this issue.
I am trying to convert a Map example from objective-c to MonoTouch but the MKCoordinateRegionMakeWithDistance isn't wrapped in .NET as far as I managed to find.
This issue has been marked as resolved by the MonoTouch team, so where is it? :-)
https://bugzilla.novell.com/show_bug.cgi?id=629743
It's there in MonoTouch 4.
using MonoTouch.MapKit;
...
var region = MKCoordinateRegion.FromDistance(center, latmeters, lngmeters);
Hope this helps.