I tried to display all my GeoCoordinate-Points on my map after loading. I found out, that i can use the setView method of the Map. I used it like this:
delMap.SetView(LocationRectangle.CreateBoundingRectangle(viewLocations));
viewLocations is a GeoCoordinate[] with 6 points. But for some reasons this is not working. The map still just centers at the point which was drawn last.
I call this in the onNavigatedTo method of the page, after drawing all the points of the locations on the map.
Anyone an idea why this is not working? Or is there a better possibility to calculate the zoom factor i need to see all the points in one view after loading.
The problem was, that I called it in the onNavigatedTo-Method. I don`t really know why this is a problem, but however, after i put it in the loaded method, it worked fine.
Related
I've been developing with Xamarin and iOS for about two weeks now, and currently I'm attempting to figure out why a strange bug is happening. I've looked all over Google and even SO, but can't find an answer...one that works, anyways. As the title says, whenever I change the Translucent boolean property of my NavigationController.NavigationBar, extra padding is added for seemingly no reason. This can be seen in the image below:
The line of code I use for this is this.NavigationController.NavigationBar.Translucent = false; and without that line, the application looks like this:
Other than that line, the NavigationController.NavigationBar is unedited. So, does anyone know what I'm doing wrong? Any help would be much appreciated...thanks SO!
It depends on the way how you construct your views and their containments.
Make sure that EdgesForExtendedLayout (Apple Docu) has the right value. I would suggest UIRectEdge.All.
In the case you are using a scrollView als check the automaticallyAdjustsScrollViewInsets property.
So, I actually figured out through posting on the Xamarin Forums and browsing through their documentation that the UINavigationBar.Translucent property adjusts the view if you turn it off such that all of the screen's contents are visible beneath the now-opaque UINavigationBar. I was simply placing the UI elements with unnecessarily large Y-values because I was unaware of the screen change after .Translucent = false;
I changed the .Frame = new CGRect(x, y, w, h) properties of each UI element with respect to 0 being right below the navigation bar, not underneath it.
I am trying to create a WPF application using C# to run on Pixelsense that is basic version of the tangram puzzle. I am able to draw my 7 shapes and translate and rotate them all around the screen.
Could anyone give me advise regarding how I should go about saving the pattern (with shapes in specific positions and orientations) so that when a user creates the pattern next time, the application can match it to the saved one and tell the user if it's correct.
It's a pattern matching and recognition problem that I am trying to solve.
I have been stuck on this for a while now :(
Define the solution as a collection of objects with shapeType, position, and orientation properties. Have the solution include one shape at position 0, 0 and an orientation of 0. Now loop over all the shapes the user has actually placed to find the ones with a shapeType that matches the shape your solution has at 0,0,0. Calculate the position and orientation of every other shape relative to where the user put this one. Compare those values to the rest of your solution. You'll need to experiment with how much tolerance to allow because this stuff is not precise - to make the game fun, err on the side of having high tolerances. If needed, you can follow this up with some performance optimizations to only re-evaluate pieces that moved.
Hopefully you are using physical shape prices with tags on them instead of this purely a virtual game. I always wanted to build this when I was on the Surface team but it never happened. One challenge you will run into is defining how the tag's position/orientation relates to the actual shape. If you'll be putting tag stickers on multiple tangram sets, you almost certainly won't get the on precisely the same each time so you may need to add a "calibration" mode to your app (have the user place each piece in a specific spot and then push a button so you can record where the tag is relative to those spots). The TagVisualizer WPF control should help a lot for building your UI - definitely look into using it (this scenario was top of mind when we designed that API). The default behavior of that control (if you tell it the ID of a tag to look for but not how to visualize it) is a "crosshair" that can help you find tune your offset values.
Good luck! If you wouldn't mind recording a YouTube video when you are done and posting a comment here linking to it, I'd really appreciate that
You can use ObservableCollection or List of a custom class. That class can consist of various values such as position, orientation etc as properties.
When a new pattern is drawn or when the pattern change its position you can update that particular object stored in the collection. As you have all the details of the pattern(positions and orientation) you can iterate the for loop and check the position of the new pattern when added.
I am writing a plugin for AutoCAD in C#.
I would like to change the position of the pivot point of a group.
It is possible to do that by mouse clicking but after deselecting and reselecting the group, it automatically moves back to it's default position (which looks like it is the center point of the bounding box).
If I use something like...
private void SetBasePoint(Group group)
{
group.AnyAvailableMethod();
//or...
group.AnyAvailableAttribute;
}
...none of the offered attributes or methods give me any solution or hint how to get there.
Does anyone have a clue how to access the pivot?
-Mike
So after working through several APIs and websites I contacted Kean Walmsley from Autodesk Developer Network and even he told me there was no direct way to get access to the pivot of a group.
So now I'm saving a user defined basepoint inside AutoCAD and whenever I need a function with a predefined pivot position I simply call my own loadBasepoint() -method which fits perfectly for my specific case.
Just in case someone runs into the same issue I thought I'd mention it :)
Hej
Lets say I have a cirkel as my usercontrol in a Windows Phone 8 application, And I add elements inside a Geometry group, with a rectangel and a line. I would get the following:
(source: c-sharpcorner.com)
I am interested in having my cirkel as the main element. To specify I want the everything else to only be displayed in the region of the cirkel.
So if the rectangle was red I would only get the red corner displayed.
I have code that can manage inserting and moving objects. But I do not know how to make the intersect work opporsit of the picture.
I have tried a bit of the same in a small sample as is done in this link:
the link is http://www.c-sharpcorner.com/uploadfile/mahesh/path-in-wpf/
Anybody has an idea for this?
Best
So the Best solution I found is to convert your element to WriteableBitmap, and then setting this as the background of your wished shape.
So to acheive the above if you have the elements as geometric shapes you can use this link to get the path of the object.
http://www.c-sharpcorner.com/uploadfile/mahesh/path-in-wpf/
I'm using bing maps components in C# for WP7 with my custom tiles.
I override Microsoft.Phone.Controls.Maps.TileSource, all ok, I'm able to use my tiles.
But, because don't have entire world, I want to limit pan only in one city bound?
It's correct to use MapDragEventArgs to check and block pan??
private void map_MapPan(object sender, MapDragEventArgs e)
{
Map m = (Map)sender;
// something...?
}
...or I need to override something else? In that case, what do I need to override?
thanks.
I have not worked with Bing Maps on Windows phone 7, so going solely by the documentation, I would do the following:
Always initialize the map such that its view bounding rectangle is within your defined tile area.
Bind to ViewChangeStart event. (or ViewChangeOnFrame, you will have to experiment and figure out which to use)
Inside handler for ViewChangeStart, check if TargetBoundingRectangle properly falls outside of your tile coverage area.
If TargetBoundingRectangle falls outside of your coverage area, figure out a way to cancel the view change or manually set the bounding rectangle back the previous valid state.
Assuming everything works like I expect it to, this should limit the users map navigation to your limited areas and avoid the behavior of the view "Snapping" back to some other place after the user has navigated.
What you can easily do and would be the best approach is to use the ViewChangeEnd event and set back the map to your coverage area.
See the MSDN reference to do this:
http://msdn.microsoft.com/en-us/library/microsoft.phone.controls.maps.core.mapcore.viewchangeend(v=vs.92).aspx