windows-phone

How do you get the button name/tag when the event button.click occurs?

大憨熊 提交于 2020-03-18 04:11:23
问题 I'm making buttons programatically and adding them to a stack panel so the buttons change each time the user navigates to the page. I'm trying to do something like this where when I click the created button it'll grab the tag of the button and go to the correct page. However, I can't access the button elements using RoutedEventHandler. Here's the code: foreach (item in list) { Button newBtn = new Button(); newBtn.Content = "Button Text"; newBtn.Tag = item.Tag; newBtn.Name = item.Name; newBtn

XAML DataContext DesignInstance with nested types

你说的曾经没有我的故事 提交于 2020-03-15 06:29:28
问题 Is it possible to specify a nested type for d:DesignInstance in XAML? And if so, how? If I have the following class structure: namespace MyApp { public class OuterClass { public class InnerClass { public string SomeData {get;set;} } } } How can I use the InnerClass type as a DesignInstance? The following doesn't work: <phone:PhoneApplicationPage ... xmlns:local="clr-namespace:MyApp" ... d:DataContext="{d:DesignInstance Type=local:OuterClass.InnerClass}" > 回答1: Try changing . to + . Something

Correct Condition For Window.External.Notify is Defined

淺唱寂寞╮ 提交于 2020-03-03 09:11:06
问题 I'm developing hybrid application that require to call window.external.notify in javascript but this js code should run in browser also. So we have to have a condition for detecting is window.external.notify is defined or undefined. So we use that code but in runtime window.external.notify shows its value is like that {...} (but can't open). Are there any way to handle it? if(window.external !== undefined && window.external.notify !== undefined) 回答1: You can use this: if (typeof (window

Correct Condition For Window.External.Notify is Defined

与世无争的帅哥 提交于 2020-03-03 09:09:29
问题 I'm developing hybrid application that require to call window.external.notify in javascript but this js code should run in browser also. So we have to have a condition for detecting is window.external.notify is defined or undefined. So we use that code but in runtime window.external.notify shows its value is like that {...} (but can't open). Are there any way to handle it? if(window.external !== undefined && window.external.notify !== undefined) 回答1: You can use this: if (typeof (window

How to make EntranceThemeTransition works on a Custom Panel & ItemsSource?

孤街浪徒 提交于 2020-02-16 02:41:26
问题 I can't get EntranceThemeTransition to work on a custom panel as ItemsPanelTemplate. See: Simplest code behind: public List<int> MyListExample = new List<int>() {0, 1, 2, 3, 4, 5}; Simplest XAML: <ListView Width="120" ItemsSource="{x:Bind MyListExample}"> <ListView.ItemContainerTransitions> <TransitionCollection> <EntranceThemeTransition FromVerticalOffset="200" IsStaggeringEnabled="True"/> </TransitionCollection> </ListView.ItemContainerTransitions> <ListView.ItemsPanel> <ItemsPanelTemplate>

How to make EntranceThemeTransition works on a Custom Panel & ItemsSource?

只愿长相守 提交于 2020-02-16 02:40:09
问题 I can't get EntranceThemeTransition to work on a custom panel as ItemsPanelTemplate. See: Simplest code behind: public List<int> MyListExample = new List<int>() {0, 1, 2, 3, 4, 5}; Simplest XAML: <ListView Width="120" ItemsSource="{x:Bind MyListExample}"> <ListView.ItemContainerTransitions> <TransitionCollection> <EntranceThemeTransition FromVerticalOffset="200" IsStaggeringEnabled="True"/> </TransitionCollection> </ListView.ItemContainerTransitions> <ListView.ItemsPanel> <ItemsPanelTemplate>

How to make EntranceThemeTransition works on a Custom Panel & ItemsSource?

回眸只為那壹抹淺笑 提交于 2020-02-16 02:38:30
问题 I can't get EntranceThemeTransition to work on a custom panel as ItemsPanelTemplate. See: Simplest code behind: public List<int> MyListExample = new List<int>() {0, 1, 2, 3, 4, 5}; Simplest XAML: <ListView Width="120" ItemsSource="{x:Bind MyListExample}"> <ListView.ItemContainerTransitions> <TransitionCollection> <EntranceThemeTransition FromVerticalOffset="200" IsStaggeringEnabled="True"/> </TransitionCollection> </ListView.ItemContainerTransitions> <ListView.ItemsPanel> <ItemsPanelTemplate>

How to change the label of shared App bar in windows phone 8.1

℡╲_俬逩灬. 提交于 2020-01-25 11:39:54
问题 Im developing an windows phone 8.1 app. I have used shared app bar across the pages. At some point of time, I need to change the label or the icon of the global app bar. Is this possible? your thoughts will be helpful. 回答1: BottomAppBar at WP8.1 is CommandBar, there you will find PrimaryCommands property, in which you probably have AppBarButtons. If you want to change for example a Label ( Icon or anything else), you should be able to do it like this: // change the label of the first button (

How to check status of bluetooth in Windows Runtime?

天涯浪子 提交于 2020-01-25 03:55:30
问题 There are some odd ways, like checking for pair devices and catching exceptions to see it if is on or not. if ((uint)ex.HResult == 0x8007048F) { var result = MessageBox.Show("Bluetooth is turned off.\nTo see the current Bluetooth settings tap 'ok'", "Bluetooth Off", MessageBoxButton.OKCancel); } But I see there is a new BluetoothConnectionStatus api but don't know how to use it. How to check bluetooth status in Windows Phone Runtime apps? 回答1: It's probably something like this: using Windows

Slider control with Move-To-Position behavior

落花浮王杯 提交于 2020-01-25 03:39:12
问题 In this page about the Slider control on Windows Phone, in the last paragraph, a behavior is mentionned: http://msdn.microsoft.com/en-us/library/hh202877(v=vs.92).aspx You can also customize the behavior of a Slider control. Depending on how it’s being used, a Slider control might benefit from the following behaviors: Move-to-Position: the thumb jumps to the position of the contact. Snap-to-Tick: the thumb jumps to the tick value that is closest to its current position in the direction of the