Last active
March 15, 2016 16:15
-
-
Save homoroselaps/e983a1cb51c4568ebf90 to your computer and use it in GitHub Desktop.
Joystick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void ManipulationStarted(object sender, ManipulationStartedRoutedEventArgs e) { | |
//Wird zu Beginn einer Beruehrung aufgerufen | |
//Enthaelt die Position als Point (z.B. e.Position.X) | |
} | |
private void ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e) { | |
//Wird bei jeder Veraenderung aufgerufen | |
//Enthaelt die Position als Point oder kumulatives(aufsummiertes) Delta | |
} | |
private void ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e) { | |
//Wird am Ende einer Beruehrung aufgerufen | |
//Enthaelt die Position als Point oder kumulatives(aufsummiertes) Delta | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Achtet darauf, das ManipulationMode korrekt gesetzt ist | |
<Canvas ManipulationMode="TranslateY, TranslateX"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Breite/Höhe eines Elements exampleControl festlegen | |
exampleControl.Width = 100.0; | |
exampleControl.Height = 100.0; | |
// Breite/Höhe eines Elements exampleControl abfragen | |
double w = exampleControl.ActualWidth; | |
double h = exampleControl.ActualHeight; | |
// Ein element exampleControl in einem Canvas positionieren | |
exampleControl.SetValue(Canvas.LeftProperty, 21.0); | |
exampleControl.SetValue(Canvas.TopProperty, 42.0); | |
// Position eines Elements exampleControl in einem Canvas abfragen | |
double x = exampleControl.GetValue(Canvas.LeftProperty); | |
double y = exampleControl.GetValue(Canvas.TopProperty); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void Page_SizeChanged(object sender, SizeChangedEventArgs e) { | |
//auslesen der aktuellen Orientierung | |
var orientation = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().Orientation; | |
if (orientation.Equals(ApplicationViewOrientation.Landscape)) { | |
//Wechsel zu VisualState "Landscape" | |
VisualStateManager.GoToState(this, "Landscape", false); | |
} | |
else { | |
VisualStateManager.GoToState(this, "Portrait", false); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment