I google it many times but can't find a proper solution
i want to get currently clicked position on map in windows phone and add pushpin to that location so that it may be saved as a reminder
try this..
private void Map_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
GeoCoordinate asd = this.Map.ConvertViewportPointToGeoCoordinate(e.GetPosition(this.Map));
}
Related
I am trying to move an object in a page form top to down on user finger movement using translate transform. we should see page contents as the bar goes down the page and sits at bottom.
Just like Action Center in windows phone 8.1.
Please let me know any ideas how we can design. Thanks.
Good question!
My first thought was to do something like this.
You could get the touch input location and then move a rectangle from the top of the screen and translate it down according to they Y Cord of the Touch Input.
EDIT:
Okay so here is what you can do.
Create a Canvas and position it somewhere at the top ( i gave it the height of 14 in collapsed state).
Then create a private void cn_ManipulationDelta(object sender, System.Windows.Input.ManipulationDeltaEventArgs e) event and make it set the height of the Canvas. I also included a float i to later make it snap back or cover the entire screen if the user lets go during the pull-event.
private void cn_ManipulationDelta(object sender, System.Windows.Input.ManipulationDeltaEventArgs e)
{
cn.Height += e.DeltaManipulation.Translation.Y;
i = (float)e.CumulativeManipulation.Translation.Y;
}
And thats it. You can also add this event to make it snap back or go cover the full screen when the user lets go.
private void cn_ManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
{
if(i < 100)
{
cn.Height = 14;
}
else
{
cn.Height = Application.Current.Host.Content.ActualHeight;
}
}
Of course you can add smoother animations so it slowly goes back into the collapsed view or fills the entire page.
I hope this helps!
I need to control the phone's vibration functionality when the user taps certain elements of my app's UI. I can't figure out how to get access the vibrator though. Is it possible? If so, how do I do this?
Yes it is possible - see Vibration Device class. This code should vibrate your phone:
private void Btn_Click(object sender, RoutedEventArgs e)
{
VibrationDevice device = VibrationDevice.GetDefault();
if (device != null) device.Vibrate(TimeSpan.FromSeconds(1));
}
The above code should work for WP8.1 WinRT, for WP8.1 Silverlight take a look here at MSDN and use VibrateController class.
I am using http://christian-helle.blogspot.in/2011/01/multi-platform-mobile-development_19.html for creating a custom list view.
In the existing sample it is not possible to pre set the selectedIndex of list view.
I have made few changes to the sample code and I am able to set the index and highlight it. but the problem is I am not able to set the scroll position to the highlighted item.
I have tried to set scrollBar.Value = itemindex, but it is not reflecting on the custom list view.
The simplest solution would be ListView.EnsureVisible.
private ListView listView1;
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
if (-1 < listView1.SelectedIndex) {
listView1.EnsureVisible(listView1.SelectedIndex);
}
}
i am using telerik silverlight lib. Version = 2011.1.411.1040
i am create one custom filter control for telerik silverlight RadGridView,
in this control one close button at right hand top corner
i want to close filter control on click of close button, how can i achieve this
after spend very long time for resolve this issue. i hope bellow code can help you, it was help me so
private void btnclose_Click(object sender, RoutedEventArgs e)
{
FilteringDropDown down = Telerik.Windows.Controls.UIElementExtensions.ParentOfType<FilteringDropDown>(this);
if (down != null)
{
down.IsDropDownOpen = false;
}
}
I put the RichTextBox in my Silverlight App. Do I have to create my own set of buttons to use it? I want to have a standard set of editing buttons for the text box.
Unfortunately it's just the textbox not a whole suite of controls too like the toolbar, which is something you get with commercial WPF/Silverlight rich text boxes.
You tie your buttons up to format code as shown here:
//Set Bold formatting to selected content
private void BtnBold_Click(object sender, RoutedEventArgs e)
{
object o = MyRTB.Selection.GetPropertyValue(TextElement.FontWeightProperty);
if (o.ToString() != "Bold")
MyRTB.Selection.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Bold);
}
//<SnippetItalic>
//Set Italic formatting to selected content
private void BtnItalic_Click(object sender, RoutedEventArgs e)
{
object o = MyRTB.Selection.GetPropertyValue(TextElement.FontWeightProperty);
if (o.ToString() != "Italic")
MyRTB.Selection.ApplyPropertyValue(TextElement.FontStyleProperty, FontStyles.Italic);
}
//Set Underline formatting to selected content
private void BtnUnderline_Click(object sender, RoutedEventArgs e)
{
object o = MyRTB.Selection.GetPropertyValue(TextElement.FontWeightProperty);
if (o.ToString() != "Underline")
MyRTB.Selection.ApplyPropertyValue(TextElement.TextDecorationsProperty, TextDecorations.Underline);
}
To give your Silverlight app a formatting toolbar with a Mircosoft Office-style feel, check out the MSDN Silverlight Text Editor example.