public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///HomePage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); pageRoot = (_8Tracks.Common.LayoutAwarePage) this.FindName("pageRoot"); groupedItemsViewSource = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("groupedItemsViewSource"); passwordPrompt = (Windows.UI.Xaml.Controls.Grid) this.FindName("passwordPrompt"); itemGridView = (Windows.UI.Xaml.Controls.GridView) this.FindName("itemGridView"); itemListView = (Windows.UI.Xaml.Controls.ListView) this.FindName("itemListView"); backButton = (Windows.UI.Xaml.Controls.Button) this.FindName("backButton"); pageTitle = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("pageTitle"); loginText = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("loginText"); loginBox = (Windows.UI.Xaml.Controls.TextBox) this.FindName("loginBox"); passwordText = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("passwordText"); passwordBox = (Windows.UI.Xaml.Controls.PasswordBox) this.FindName("passwordBox"); doneButton = (Windows.UI.Xaml.Controls.Button) this.FindName("doneButton"); ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup) this.FindName("ApplicationViewStates"); FullScreenLandscape = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenLandscape"); Filled = (Windows.UI.Xaml.VisualState) this.FindName("Filled"); FullScreenPortrait = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenPortrait"); Snapped = (Windows.UI.Xaml.VisualState) this.FindName("Snapped"); }
public void calculatorCategoryClicked(object sender, RoutedEventArgs e) { Windows.UI.Xaml.Controls.Button b = (Windows.UI.Xaml.Controls.Button)sender; if (b.Name == "Food") { NavigateTo(typeof(FoodCalculator)); } else if (b.Name == "Nonfood") { NavigateTo(typeof(NFCalculator)); } else if (b.Name == "NonfoodDF") { NavigateTo(typeof(NonfoodDFCalculator)); } else if (b.Name == "Cooler") { NavigateTo(typeof(CoolerCalculator)); } else if (b.Name == "Freezer") { NavigateTo(typeof(FreezerCalculator)); } }
void myAdd(Button x) { if (expression.Text == "0") expression.Text = x.Content.ToString(); else expression.Text = expression.Text + x.Content.ToString(); }
public async Task<object> AsyncTaskReturnsObjectUIMethod() { Button b = new Button(); _shouldBeSet = "Yep it is set."; return 5; }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///SearchResultsPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); pageRoot = (SimpleSearchProvider.Common.LayoutAwarePage) this.FindName("pageRoot"); resultsViewSource = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("resultsViewSource"); filtersViewSource = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("filtersViewSource"); resultsPanel = (Windows.UI.Xaml.Controls.Grid) this.FindName("resultsPanel"); noResultsTextBlock = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("noResultsTextBlock"); typicalPanel = (Windows.UI.Xaml.Controls.Grid) this.FindName("typicalPanel"); snappedPanel = (Windows.UI.Xaml.Controls.Grid) this.FindName("snappedPanel"); resultsListView = (Windows.UI.Xaml.Controls.ListView) this.FindName("resultsListView"); filtersItemsControl = (Windows.UI.Xaml.Controls.ItemsControl) this.FindName("filtersItemsControl"); resultsGridView = (Windows.UI.Xaml.Controls.GridView) this.FindName("resultsGridView"); backButton = (Windows.UI.Xaml.Controls.Button) this.FindName("backButton"); pageTitle = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("pageTitle"); resultText = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("resultText"); queryText = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("queryText"); ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup) this.FindName("ApplicationViewStates"); ResultStates = (Windows.UI.Xaml.VisualStateGroup) this.FindName("ResultStates"); ResultsFound = (Windows.UI.Xaml.VisualState) this.FindName("ResultsFound"); NoResultsFound = (Windows.UI.Xaml.VisualState) this.FindName("NoResultsFound"); FullScreenLandscape = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenLandscape"); Filled = (Windows.UI.Xaml.VisualState) this.FindName("Filled"); FullScreenPortrait = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenPortrait"); Snapped = (Windows.UI.Xaml.VisualState) this.FindName("Snapped"); }
private async void btnExpand_Click(object sender, RoutedEventArgs e) { DisplayFadeMessage("Resize Music Area"); Windows.UI.Xaml.Controls.Button TheButton = ((Windows.UI.Xaml.Controls.Button)sender); Windows.UI.Xaml.Controls.Image ButtonImage = ((Windows.UI.Xaml.Controls.Image)TheButton.Content); if (flipView1.Visibility == Visibility.Visible) { //Expand the music list to take up more space flipView1.Visibility = Visibility.Collapsed; lvFiles.Height = this.TallListHeight; lvPlaylist.Height = this.TallListHeight; wvBrowser.Height = this.TallListHeight; ButtonImage.Source = new BitmapImage(new Uri(this.BaseUri, "/Assets/collapse_menu.png")); } else { //Shrink the music list to take up less space flipView1.Visibility = Visibility.Visible; lvFiles.Height = this.ShortListHeight; lvPlaylist.Height = this.ShortListHeight; wvBrowser.Height = this.ShortListHeight; ButtonImage.Source = new BitmapImage(new Uri(this.BaseUri, "/Assets/expand_menu.png")); } }
public async Task AsyncTaskUIMethod() { ExecuteUIThread.RealDelay(1000); Button b = new Button(); _shouldBeSet = "Yep it is set."; }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-resource://spotifyapp/Files/View/DetailPage.xaml")); CollectionViewSource = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("CollectionViewSource"); LayoutRoot = (Windows.UI.Xaml.Controls.Grid) this.FindName("LayoutRoot"); OrientationStates = (Windows.UI.Xaml.VisualStateGroup) this.FindName("OrientationStates"); Full = (Windows.UI.Xaml.VisualState) this.FindName("Full"); Fill = (Windows.UI.Xaml.VisualState) this.FindName("Fill"); Portrait = (Windows.UI.Xaml.VisualState) this.FindName("Portrait"); Snapped = (Windows.UI.Xaml.VisualState) this.FindName("Snapped"); FlipView = (Windows.UI.Xaml.Controls.FlipView) this.FindName("FlipView"); ApplicationBar = (Windows.UI.Xaml.Controls.ApplicationBar) this.FindName("ApplicationBar"); NextPanel = (Windows.UI.Xaml.Controls.StackPanel) this.FindName("NextPanel"); NextButton = (Windows.UI.Xaml.Controls.Button) this.FindName("NextButton"); PreviousButton = (Windows.UI.Xaml.Controls.Button) this.FindName("PreviousButton"); HomeButton = (Windows.UI.Xaml.Controls.Button) this.FindName("HomeButton"); BackButton = (Windows.UI.Xaml.Controls.Button) this.FindName("BackButton"); PageTitle = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("PageTitle"); }
protected async override void OnNavigatedTo(NavigationEventArgs e) { var pstudent1 = await todoTable .Where(t => t.username == e.Parameter.ToString()).ToCollectionAsync(); //newkey = pstudent1[0].username; ar[0] = pstudent1[0].eng; ar[1] = pstudent1[0].hin; ar[2] = pstudent1[0].math; ar[3] = pstudent1[0].sci; ar[4] = pstudent1[0].ss; ar[5] = pstudent1[0].cs; ar2[0] = "English"; ar2[1] = "Hindi"; ar2[2] = "Maths"; ar2[3] = "Science"; ar2[4] = "Social Science"; ar2[5] = "Computer Science"; Button[] buttons = new Button[] { button, button1, button2, button3, button4, button5 }; int j = 0; for (int i = 0; i < 6; i = i + 1) { if (ar[i] == true) { buttons[j].Content = ar2[i]; buttons[j].Visibility = Visibility.Visible; j++; } } var pstudent2 = await todoTable .Where(t => t.username == e.Parameter.ToString()).ToCollectionAsync(); newkey = pstudent2[0].username; }
void CodePage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { Current = this; AppBar timeTracker = new AppBar(); var homeButton = new Button(); homeButton.Name = "btnHome"; homeButton.Click += HomeButton_Click; homeButton.Content = "Home"; var sPanel = new StackPanel(); sPanel.Children.Add(homeButton); timeTracker.Background = new SolidColorBrush(new Color { A = 33, R = 118, G = 15, B = 5 }); var ttControl = new TimeTrackerControl(); ttControl.CPRStartTime = CurrentCode.CPRStartTime.ToString(@"MM/dd/yyyy H\:mm"); sPanel.Children.Add(ttControl); timeTracker.Content = sPanel; timeTracker.IsOpen = true; timeTracker.IsSticky = true; this.TopAppBar = timeTracker; if (CurrentDefibrillation.Resuscitations == null) { CurrentDefibrillation.Resuscitations = new List<Resuscitation>(); } }
protected override void Dispose(bool disposing) { if (disposing && !_disposed) { prevBtn = null; nextBtn = null; indicators = null; if (flipView != null) { flipView.SelectionChanged -= FlipView_SelectionChanged; flipView = null; } if (_collectionListenerSource != null) { _collectionListenerSource.CollectionChanged -= ItemsSource_CollectionChanged; _collectionListenerSource = null; } nativeView = null; _disposed = true; } try { base.Dispose(disposing); } catch (Exception ex) { return; } }
/// <summary> /// Constructor, initialize the components. /// </summary> public Uploading() { this.InitializeComponent(); ctx = new CloudEDUEntities(new Uri(Constants.DataServiceURI)); addImageButton = imageAddButton; }
private void BlankPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args) { SettingsCommand cmd = new SettingsCommand("sample", "Sample Custom Setting", (x) => { SettingsFlyout settings = new SettingsFlyout(); settings.FlyoutWidth = (Callisto.Controls.SettingsFlyout.SettingsFlyoutWidth)Enum.Parse(typeof(Callisto.Controls.SettingsFlyout.SettingsFlyoutWidth), settingswidth.SelectionBoxItem.ToString()); //settings.HeaderBrush = new SolidColorBrush(Colors.Orange); //settings.Background = new SolidColorBrush(Colors.White); settings.HeaderText = "Foo Bar Custom Settings"; BitmapImage bmp = new BitmapImage(new Uri("ms-appx:///Assets/SmallLogo.png")); settings.SmallLogoImageSource = bmp; StackPanel sp = new StackPanel(); ToggleSwitch ts = new ToggleSwitch(); ts.Header = "Download updates automatically"; Button b = new Button(); b.Content = "Test"; sp.Children.Add(ts); sp.Children.Add(b); settings.Content = sp; settings.IsOpen = true; ObjectTracker.Track(settings); }); args.Request.ApplicationCommands.Add(cmd); }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); // make sure we listen at the right time to add/remove the back button event handlers if (_backButton != null) { _backButton.Tapped -= OnBackButtonTapped; } _backButton = GetTemplateChild("SettingsBackButton") as Button; if (_backButton != null) { _backButton.Tapped += OnBackButtonTapped; } // need to get these grids in order to set the offsets correctly in RTL situations //if (_contentGrid == null) //{ // _contentGrid = GetTemplateChild("SettingsFlyoutContentGrid") as Grid; //} //_contentGrid.Transitions = new TransitionCollection(); //_contentGrid.Transitions.Add(new EntranceThemeTransition() //{ // FromHorizontalOffset = CONTENT_HORIZONTAL_OFFSET // TODO: if left edge need to multiply by -1 //}); }
private void HaveIssues(Button bt) { try { Model.FAQ_Category category = new Model.FAQ_Category(); category = (Model.FAQ_Category)bt.DataContext; if (category != null) Account.Category = category.serverCategory; if (bt.Name.Equals("BtnOther")) this.Frame.Navigate(typeof(Views.Help)); else if (category == null & bt.Name.Equals("BtnTop")) Frame.Navigate(typeof(Views.FAQ_QuestionAns), new Model.PassedData {Parameter1_name = "Code", Parameter1_value = "1"}); else { Account.Category = category.serverCategory; this.Frame.Navigate(typeof(Views.FAQ_homeQuest), new Model.PassedData { Parameter1_name = "Code", Parameter1_value = category.onClickId.ToString(), Parameter2_name = "Category", Parameter2_value = category.serverCategory }); //this.Frame.Navigate(typeof(Views.FAQ_homeQuest)); } } catch (Exception ex) { //List<Parameter> Params = new List<Parameter>(); //Params.Add(AccountFunctions.createParameter("Location", "FAQ home")); //Params.Add(AccountFunctions.createParameter("Method", "HaveIssues load, Error:" + ex.Message)); //FlurryWP8SDK.Api.LogEvent("FAQ Exception", Params); } }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); // make sure we listen at the right time to add/remove the back button event handlers if(_backButton != null) { _backButton.Tapped -= OnBackButtonTapped; } _backButton = GetTemplateChild("SettingsBackButton") as Button; if(_backButton != null) { _backButton.Tapped += OnBackButtonTapped; } // need to get these grids in order to set the offsets correctly in RTL situations if (_contentGrid == null) { _contentGrid = GetTemplateChild("SettingsFlyoutContentGrid") as Grid; } _contentGrid.Transitions = new TransitionCollection(); _contentGrid.Transitions.Add(new EntranceThemeTransition() { FromHorizontalOffset = (SettingsPane.Edge == SettingsEdgeLocation.Right) ? CONTENT_HORIZONTAL_OFFSET : (CONTENT_HORIZONTAL_OFFSET * -1) }); // need the root border for RTL scenarios _rootBorder = GetTemplateChild("PART_RootBorder") as Border; // need the content scrollviewer to set the fixed width to be the same size as flyout _contentScrollViewer = GetTemplateChild("PART_ContentScrollViewer") as ScrollViewer; }
private async void btn_Click(object sender, RoutedEventArgs e) { await Task.Run(() => { for (int i = 0; i < 30000; i++) { // str += i.ToString(); } }); progressring.IsActive = !progressring.IsActive; this.txt.Text = num++.ToString(); if (progressring.IsActive == true) { btn.Content = "停止菊花"; } else { btn.Content = "开始菊花"; } Button nb = new Button(); nb.Content = "新♥"; nb.HorizontalAlignment =HorizontalAlignment.Center; stp.Children.Add(nb); }
private void showButtons() { int upMargin = 140; int leftMargin = -285; for ( int i = 0; i < 26; i++ ) { Button b = new Button(); b.Height = 60; b.Width = 40; b.MinHeight = 0; b.MinWidth = 0; b.Visibility = Windows.UI.Xaml.Visibility.Visible; if(vis[i] == 1) b.Visibility = Windows.UI.Xaml.Visibility.Collapsed; b.FontFamily = new FontFamily("/Fonts/Segoe.ttf#Segoe Print"); b.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center; b.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Bottom; b.Content = alphabets[i]; b.Name = alphabets[i].ToString(); b.Click += a_Click; Thickness margin = b.Margin; margin.Left = leftMargin; margin.Bottom = upMargin; b.Margin = margin; mainGrid.Children.Add(b); leftMargin += 85; if((i+1)%8 == 0) { upMargin -= 46; leftMargin = -285; } } }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. The Parameter /// property is typically used to configure the page.</param> protected override void OnNavigatedTo(NavigationEventArgs e) { XNamespace p_ns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"; XNamespace xaml_ns = "http://schemas.microsoft.com/winfx/2006/xaml"; var doc = XDocument.Load(@"Common\StandardStyles.xaml"); foreach (var style in doc.Descendants(p_ns + "Style")) { var key = style.Attribute(xaml_ns + "Key"); if (key != null && key.Value != null) { var basedOn = style.Attribute("BasedOn"); if (basedOn != null && basedOn.Value == @"{StaticResource AppBarButtonStyle}") { var button = new Button(); button.Style = App.Current.Resources[key.Value] as Style; ToolTipService.SetToolTip(button, key.Value); button.Click += (sender, args) => { string styleName = ToolTipService.GetToolTip(sender as Button) as string; DataPackage clipboardData = new DataPackage(); clipboardData.SetText(styleName); Clipboard.SetContent(clipboardData); }; AppBarButtonListView.Items.Add(button); } } } }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///Tweet.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); pageRoot = (Mu_genotype1.Common.LayoutAwarePage)this.FindName("pageRoot"); primaryColumn = (Windows.UI.Xaml.Controls.ColumnDefinition)this.FindName("primaryColumn"); titlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("titlePanel"); itemListScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer"); itemListScrollViewer2 = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer2"); PeerTweets = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("PeerTweets"); itemListView2 = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView2"); TweetBox = (Windows.UI.Xaml.Controls.TextBox)this.FindName("TweetBox"); TweetIt = (Windows.UI.Xaml.Controls.Button)this.FindName("TweetIt"); PinPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("PinPanel"); itemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView"); PinTb = (Windows.UI.Xaml.Controls.TextBox)this.FindName("PinTb"); VerifyPinButton = (Windows.UI.Xaml.Controls.Button)this.FindName("VerifyPinButton"); backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton"); pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle"); pageSubtitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageSubtitle"); FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape"); Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled"); FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait"); FullScreenPortrait_Detail = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait_Detail"); Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped"); Snapped_Detail = (Windows.UI.Xaml.VisualState)this.FindName("Snapped_Detail"); TwitterConnectBtn = (Windows.UI.Xaml.Controls.Button)this.FindName("TwitterConnectBtn"); RefreshButton = (Windows.UI.Xaml.Controls.Button)this.FindName("RefreshButton"); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { ResultCollection = new ObservableCollection<WiFiNetworkDisplay>(); rootPage = MainPage.Current; // RequestAccessAsync must have been called at least once by the app before using the API // Calling it multiple times is fine but not necessary // RequestAccessAsync must be called from the UI thread var access = await WiFiAdapter.RequestAccessAsync(); if (access != WiFiAccessStatus.Allowed) { rootPage.NotifyUser("Access denied", NotifyType.ErrorMessage); } else { DataContext = this; var result = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(WiFiAdapter.GetDeviceSelector()); if (result.Count >= 1) { firstAdapter = await WiFiAdapter.FromIdAsync(result[0].Id); var button = new Button(); button.Content = string.Format("Scan"); button.Click += Button_Click; Buttons.Children.Add(button); } else { rootPage.NotifyUser("No WiFi Adapters detected on this machine", NotifyType.ErrorMessage); } } }
/// <summary> /// Initializes a new instance of the <see cref="AppbarContent"/> class. /// </summary> public AppbarContent() { this.InitializeComponent(); searchTextBlock = searchBox; this.advanceSearchButton = AdvanceSearchButton; }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-resource://spotifyapp/Files/View/CollectionSummaryPage.xaml")); CollectionViewSource = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("CollectionViewSource"); LayoutRoot = (Windows.UI.Xaml.Controls.Grid) this.FindName("LayoutRoot"); OrientationStates = (Windows.UI.Xaml.VisualStateGroup) this.FindName("OrientationStates"); Full = (Windows.UI.Xaml.VisualState) this.FindName("Full"); Fill = (Windows.UI.Xaml.VisualState) this.FindName("Fill"); Portrait = (Windows.UI.Xaml.VisualState) this.FindName("Portrait"); Snapped = (Windows.UI.Xaml.VisualState) this.FindName("Snapped"); ScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer) this.FindName("ScrollViewer"); CategoryPanel = (Windows.UI.Xaml.Controls.StackPanel) this.FindName("CategoryPanel"); HeaderTitlePanel = (Windows.UI.Xaml.Controls.Grid) this.FindName("HeaderTitlePanel"); ItemGridView = (Windows.UI.Xaml.Controls.GridView) this.FindName("ItemGridView"); ItemListView = (Windows.UI.Xaml.Controls.ListView) this.FindName("ItemListView"); Title = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("Title"); Image = (Windows.UI.Xaml.Controls.Image) this.FindName("Image"); DescriptionText = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("DescriptionText"); BackButton = (Windows.UI.Xaml.Controls.Button) this.FindName("BackButton"); PageTitle = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("PageTitle"); }
//http://blog.jerrynixon.com/2012/06/windows-8-how-to-read-files-in-winrt.html //private async void ProjectFile() //{ // var _Folder = Windows.ApplicationModel.Package.Current.InstalledLocation; // _Folder = await _Folder.GetFolderAsync(@"Assets"); // var _File = await _Folder.GetFileAsync(@"Lyon.json"); // json = await Windows.Storage.FileIO.ReadTextAsync(_File); //} public HubPage() { this.InitializeComponent(); List<LyonStation> stations = DoWork.DeserializeStations(); foreach (var station in stations) { var myButton = new Button(); //AsyncContext.Run(async () => //{ // string js = ""; // HttpClient httpClient = new HttpClient(); // HttpRequestMessage msg = new HttpRequestMessage(new HttpMethod("GET"), new Uri("https://api.jcdecaux.com/vls/v1/stations/" + station.number + "?contract=Lyon&apiKey=8554d38cbccde6f2ca5db7fdd689f1b588ce7786")); // msg.Content = new HttpStringContent(js); // msg.Content.Headers.ContentType = new HttpMediaTypeHeaderValue("application/json"); // HttpResponseMessage response = await httpClient.SendRequestAsync(msg).AsTask(); // string s = await response.Content.ReadAsStringAsync(); // LyonStation lyonStation = Helper.Deserialize<LyonStation>(s); // pin.Text = lyonStation.available_bikes.ToString() + "/" + (lyonStation.available_bike_stands + lyonStation.available_bikes).ToString(); //}); MapLayer.SetPosition(myButton, new Location(station.latitude, station.longitude)); myButton.Tapped += Helper.DisplayRibbon(station, myButton); //myButton.PointerEntered += myButton_PointerEntered; myButton.PointerMoved += myButton_PointerEntered; myButton.PointerExited += myButton_PointerExited; myMap.Children.Add(myButton); } }
private void GetNaviButtonControl() { if (this.naviButton == null) { this.naviButton = this.GetTemplateChild("NaviButton") as Button; } }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///HomePage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); pageRoot = (_8Tracks.Common.LayoutAwarePage)this.FindName("pageRoot"); groupedItemsViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("groupedItemsViewSource"); passwordPrompt = (Windows.UI.Xaml.Controls.Grid)this.FindName("passwordPrompt"); itemGridView = (Windows.UI.Xaml.Controls.GridView)this.FindName("itemGridView"); itemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView"); backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton"); pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle"); loginText = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("loginText"); loginBox = (Windows.UI.Xaml.Controls.TextBox)this.FindName("loginBox"); passwordText = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("passwordText"); passwordBox = (Windows.UI.Xaml.Controls.PasswordBox)this.FindName("passwordBox"); doneButton = (Windows.UI.Xaml.Controls.Button)this.FindName("doneButton"); ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("ApplicationViewStates"); FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape"); Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled"); FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait"); Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped"); }
public void ChangeButtonsAmount(int amount) { ButtonsPanel.Children.Clear(); for (int i = 0; i < amount; i++) { TextBlock tempTextBlock = new TextBlock(); Button tempButton = new Button(); StackPanel tempPanel = new StackPanel(); tempTextBlock.Text = (i + 1).ToString(); tempTextBlock.TextAlignment = TextAlignment.Center; tempTextBlock.Width = tempButton.Width; tempButton.Name = "AdditionalButton"; tempButton.Template = ButtonTemplate; tempButton.Content = i + 1; tempButton.Click += ButtonPressed; tempPanel.Children.Add(tempTextBlock); tempPanel.Children.Add(tempButton); tempPanel.Width = tempButton.Width; ButtonsPanel.Children.Add(tempPanel); ButtonsPanel.Width += tempButton.Width; } }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); _moreButton = GetTemplateChild("MoreButton") as Windows.UI.Xaml.Controls.Button; _primaryItemsControl = GetTemplateChild("PrimaryItemsControl") as Windows.UI.Xaml.Controls.ItemsControl; }
protected override void OnApplyTemplate() { _frame = base.GetTemplateChild("frame") as Panel; _panel = base.GetTemplateChild("panel") as CarouselPanel; _arrows = base.GetTemplateChild("arrows") as Grid; _left = base.GetTemplateChild("left") as Button; _right = base.GetTemplateChild("right") as Button; _gradient = base.GetTemplateChild("gradient") as LinearGradientBrush; _clip = base.GetTemplateChild("clip") as RectangleGeometry; _frame.ManipulationDelta += OnManipulationDelta; _frame.ManipulationCompleted += OnManipulationCompleted; _frame.ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.System; _frame.PointerMoved += OnPointerMoved; _left.Click += OnLeftClick; _right.Click += OnRightClick; _left.PointerEntered += OnArrowPointerEntered; _left.PointerExited += OnArrowPointerExited; _right.PointerEntered += OnArrowPointerEntered; _right.PointerExited += OnArrowPointerExited; base.OnApplyTemplate(); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { ResultCollection = new ObservableCollection<WiFiNetworkDisplay>(); rootPage = MainPage.Current; // RequestAccessAsync must have been called at least once by the app before using the API // Calling it multiple times is fine but not necessary // RequestAccessAsync must be called from the UI thread var result = await WiFiAdapter.RequestAccessAsync(); if (result != WiFiAccessStatus.Allowed) { rootPage.NotifyUser("Access denied", NotifyType.ErrorMessage); } else { DataContext = this; wiFiAdapters = await WiFiAdapter.FindAllAdaptersAsync(); int index = 0; foreach (var adapter in wiFiAdapters) { var button = new Button(); button.Tag = index; button.Content = String.Format("WiFi Adapter {0}", ++index); button.Click += Button_Click; Buttons.Children.Add(button); } } }
public void StartScore() { PauseButton.Visibility = Visibility.Visible; //int numberOfScores = colors.Count; //Chosen = GenerateSize.Next(numberOfScores); //levelColor = colors[Chosen]; ColorButton = new Button(); ColorButton.Foreground = levelColor; ColorButton.BorderBrush = levelColor; ColorButton.Background = levelColor; ColorButton.Margin = new Thickness(40, 0, 0, 0); ScoreBoard.Children.Add(ColorButton); levelScoreButtom.Margin = new Thickness(this.ActualWidth * 3 / 4, 15, 0, 0); levelScoreButtom.Visibility = Visibility.Visible; levelScoreButtom.FontSize = 14; levelScoreButtom.Foreground = levelColor; livesDisplay.Margin = new Thickness(this.ActualWidth * 3 / 4, 30, 0, 0); livesDisplay.Foreground = levelColor; livesDisplay.Visibility = Visibility.Visible; livesDisplay.FontSize = 14; CurrentlevelButton.Foreground = levelColor; CurrentlevelButton.Margin = new Thickness(this.ActualWidth * 3 / 4, 45, 0, 0); CurrentlevelButton.Visibility = Visibility.Visible; CurrentlevelButton.FontSize = 14; }
public async void Scan() { var access = await WiFiAdapter.RequestAccessAsync(); var result = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(WiFiAdapter.GetDeviceSelector()); if (result.Count >= 1) { nwAdapter = await WiFiAdapter.FromIdAsync(result[0].Id); await nwAdapter.ScanAsync(); sp.Children.Clear(); foreach (var item in nwAdapter.NetworkReport.AvailableNetworks) { StackPanel s = new StackPanel(); s.Orientation = Orientation.Horizontal; Button b = new Button(); TextBlock t = new TextBlock(); t.Text = $"{item.NetworkRssiInDecibelMilliwatts} {item.ChannelCenterFrequencyInKilohertz} {item.IsWiFiDirect} {item.NetworkKind} {item.SecuritySettings.NetworkAuthenticationType} {item.SecuritySettings.NetworkAuthenticationType} {item.SignalBars} {item.Uptime}"; b.Content += item.Ssid; b.Click += B_Click; s.Children.Add(b); s.Children.Add(t); sp.Children.Add(s); } } }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///ItemDetailPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); pageRoot = (ContosoCookbook.Common.LayoutAwarePage) this.FindName("pageRoot"); itemsViewSource = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("itemsViewSource"); PageAppBar = (Windows.UI.Xaml.Controls.AppBar) this.FindName("PageAppBar"); LeftCommands = (Windows.UI.Xaml.Controls.StackPanel) this.FindName("LeftCommands"); RightCommands = (Windows.UI.Xaml.Controls.StackPanel) this.FindName("RightCommands"); BragButton = (Windows.UI.Xaml.Controls.Button) this.FindName("BragButton"); PinRecipeButton = (Windows.UI.Xaml.Controls.Button) this.FindName("PinRecipeButton"); flipView = (Windows.UI.Xaml.Controls.FlipView) this.FindName("flipView"); portraitFlipView = (Windows.UI.Xaml.Controls.FlipView) this.FindName("portraitFlipView"); snappedFlipView = (Windows.UI.Xaml.Controls.FlipView) this.FindName("snappedFlipView"); backButton = (Windows.UI.Xaml.Controls.Button) this.FindName("backButton"); pageTitle = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("pageTitle"); ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup) this.FindName("ApplicationViewStates"); FullScreenLandscape = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenLandscape"); Filled = (Windows.UI.Xaml.VisualState) this.FindName("Filled"); FullScreenPortrait = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenPortrait"); Snapped = (Windows.UI.Xaml.VisualState) this.FindName("Snapped"); }
public NoteContent(object sender , object sender1) { this.InitializeComponent(); item = (Button)sender; item1 = (Button) sender1; notepadRepository = new NotepadRepository(); ourNotes = notepadRepository.GetNotes(item.Content.ToString().ToLower()); notepad = ourNotes[0].notepad; foreach (Note note in ourNotes) { if (note.title == item1.Content.ToString().ToLower()) CurrNote = note; } if (CurrNote != null) { if (CurrNote.title == "+") CurrNote.title = "New Title"; NoteAct.Text = CurrNote.content; //NoteAct.Document.SetText(new Windows.UI.Text.TextSetOptions(), CurrNote.content); NoteName.Text = CurrNote.title; } AppTitle.Text = notepad; foreach (Note note in ourNotes) { notes.Items.Add(createNoteButton(note.title,note.content)); } }
protected override void OnApplyTemplate() { textBox = GetTemplateChild(PART_TEXT_NAME) as TextBox; button = GetTemplateChild(PART_BUTTON_NAME) as Button; InitEvents(); }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-resource://spotifyapp/Files/View/CollectionSummaryPage.xaml")); CollectionViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("CollectionViewSource"); LayoutRoot = (Windows.UI.Xaml.Controls.Grid)this.FindName("LayoutRoot"); OrientationStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("OrientationStates"); Full = (Windows.UI.Xaml.VisualState)this.FindName("Full"); Fill = (Windows.UI.Xaml.VisualState)this.FindName("Fill"); Portrait = (Windows.UI.Xaml.VisualState)this.FindName("Portrait"); Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped"); ScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("ScrollViewer"); CategoryPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("CategoryPanel"); HeaderTitlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("HeaderTitlePanel"); ItemGridView = (Windows.UI.Xaml.Controls.GridView)this.FindName("ItemGridView"); ItemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("ItemListView"); Title = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("Title"); Image = (Windows.UI.Xaml.Controls.Image)this.FindName("Image"); DescriptionText = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("DescriptionText"); BackButton = (Windows.UI.Xaml.Controls.Button)this.FindName("BackButton"); PageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("PageTitle"); }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///ArtistDetails.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); pageRoot = (Mu_genotype1.Common.LayoutAwarePage)this.FindName("pageRoot"); primaryColumn = (Windows.UI.Xaml.Controls.ColumnDefinition)this.FindName("primaryColumn"); titlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("titlePanel"); itemListScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer"); itemDetail = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemDetail"); itemDetailGrid = (Windows.UI.Xaml.Controls.Grid)this.FindName("itemDetailGrid"); itemDetailTitlePanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("itemDetailTitlePanel"); ArtistContentTb = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("ArtistContentTb"); itemTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("itemTitle"); itemSubtitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("itemSubtitle"); itemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView"); backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton"); pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle"); FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape"); Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled"); FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait"); FullScreenPortrait_Detail = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait_Detail"); Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped"); Snapped_Detail = (Windows.UI.Xaml.VisualState)this.FindName("Snapped_Detail"); }
private async void Button_UseUWPDefaultStyles_Loaded(object sender, RoutedEventArgs e) { #if !NETFX_CORE var originalFlagValue = Uno.UI.FeatureConfiguration.Style.UseUWPDefaultStyles; Uno.UI.FeatureConfiguration.Style.UseUWPDefaultStyles = false; #endif var button = new Windows.UI.Xaml.Controls.Button() { Content = "Native button" }; RootPanel.Children.Add(button); await Task.Yield(); var nativeView = button.FindFirstChild <_NativeType>(); if (nativeView != null) { ResultsTextBlock.Text = "Native view found"; } else { ResultsTextBlock.Text = "Native view not found"; } #if !NETFX_CORE Uno.UI.FeatureConfiguration.Style.UseUWPDefaultStyles = originalFlagValue; #endif }
private async void ButtonValid_Click(object sender, RoutedEventArgs e) { Exception lastException; try { await StorageFolder.GetFolderFromPathAsync(BoxFolderPath.Text); return; } catch (Exception ex) { lastException = ex; } string text = lastException.Message.TrimEnd(Environment.NewLine.ToCharArray()); var panel = new StackPanel() { Orientation = Orientation.Vertical }; if (lastException is UnauthorizedAccessException) { var button = new Button() { Content = "Manage accessable folders" }; button.Click += (a, b) => { ParentPage.App.SplitPage.Navigate<PreferencesPage>(1); }; panel.Children.Add(button); } panel.Children.Add(new TextBlock() { Text = text }); ButtonValid.AttachFlyout(new Flyout() { Content = panel }); ButtonValid.ShowFlyout(); }
private void showPopup_Click(object sender, RoutedEventArgs e) { // Create some content to show in the popup. Typically you would // create a user control. Border border = new Border(); border.BorderThickness = new Thickness(5.0); StackPanel panel1 = new StackPanel(); Button button1 = new Button(); button1.Content = "Close"; button1.Margin = new Thickness(5.0); button1.Click += new RoutedEventHandler(button1_Click); TextBlock textblock1 = new TextBlock(); textblock1.Text = "The popup control"; textblock1.Margin = new Thickness(5.0); panel1.Children.Add(textblock1); panel1.Children.Add(button1); border.Child = panel1; MoviePlayer MovieFrame = new MoviePlayer(ref p); // Set the Child property of Popup to the border // which contains a stackpanel, textblock and button. p.Child = MovieFrame; // Set where the popup will show up on the screen. p.VerticalOffset = 110; p.HorizontalOffset = 0; // Open the popup. p.IsLightDismissEnabled = true; p.IsOpen = true; }
public async Task Display(string message, ImageSource imageSource) { var handler = GetHandler(imageSource); var windowsImageSource = await handler.LoadImageAsync(imageSource); var image = new Windows.UI.Xaml.Controls.Image() { Source = windowsImageSource }; if (image != null) { Popup popup = new Popup(); StackPanel stackPanel = new StackPanel(); stackPanel.Background = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Color.FromArgb(255, 244, 244, 244)); stackPanel.Width = Application.Current.MainPage.Width; var button = new Windows.UI.Xaml.Controls.Button(); button.Content = "X"; button.Foreground = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Black); button.BorderBrush = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Black); button.Click += (sender, e) => { popup.IsOpen = false; }; if (!string.IsNullOrEmpty(message)) { var label = new Windows.UI.Xaml.Controls.TextBlock() { Text = message, FontSize = 48, Padding = new Windows.UI.Xaml.Thickness(8), }; stackPanel.Children.Add(label); } stackPanel.Children.Add(image); stackPanel.Children.Add(button); popup = new Popup() { Child = stackPanel, IsOpen = true, VerticalOffset = 30 }; popup.DragLeave += (sender, e) => { ((Popup)sender).IsOpen = false; }; } else { throw new ArgumentNullException("Image is null"); } }
private void Button_Click(object sender, RoutedEventArgs e) { Windows.UI.Xaml.Controls.Button btn = (sender as Button); String content = btn.Content.ToString(); display.Text = calc.Click(content); sizeCheck(); }
private void mousedMoved(object sender, PointerRoutedEventArgs e) { if (entered == true && exited == false) { running_counter++; if (running_counter == internal_counter) { running_counter = 0; counter--; String location = "ms-appx:///Assets/" + counter + ".png"; (sender as Windows.UI.Xaml.Controls.Button).Background = new ImageBrush { ImageSource = new BitmapImage(new Uri(location)) }; } if (counter == 1) { if (ApplicationData.Current.RoamingSettings.Values.ContainsKey("UserName")) { UserName = (String)ApplicationData.Current.RoamingSettings.Values["UserName"]; } else { UserName = "******"; } Debug.WriteLine("Trigger execution!!!!!!!!"); (sender as Windows.UI.Xaml.Controls.Button).Background = new ImageBrush { ImageSource = new BitmapImage(new Uri("ms-appx:///Assets/Sent.png")) }; Windows.UI.Xaml.Controls.Button but = (sender as Windows.UI.Xaml.Controls.Button); String message = but.Content.ToString(); ParsePush push = new ParsePush(); push.Channels = new List <String> { "global" }; IDictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("sound", "."); dic.Add("alert", UserName + ": " + message); // dic.Add("time", UserName); push.Data = dic; push.SendAsync(); ParseObject internal_tweets = new ParseObject("TweetsInternal"); internal_tweets["content"] = message; internal_tweets["sender"] = UserName; internal_tweets.SaveAsync(); entered = false; exited = true; } } }
private void DeferredDialog_Click(object sender, RoutedEventArgs args) { DidCloseTextBlock.Text = "Not closed"; var dialog = new ContentDialog { CloseButtonText = "Close" }; ContentDialogClosingDeferral deferral1 = null; ContentDialogClosingDeferral deferral2 = null; var defer1Button = new _Button { Name = "Complete1Button", Content = "Complete 1" }; defer1Button.Click += (o, e) => { deferral1.Complete(); ResultTextBlock.Text = "First complete called"; }; var defer2Button = new _Button { Name = "Complete2Button", Content = "Complete 2" }; defer2Button.Click += (o, e) => { deferral2.Complete(); ResultTextBlock.Text = "Second complete called"; }; var panel = new StackPanel { Orientation = Orientation.Horizontal, Children = { defer1Button, defer2Button } }; dialog.Content = panel; dialog.Closing += (o, e) => { deferral1 = e.GetDeferral(); }; dialog.Closing += (o, e) => { deferral2 = e.GetDeferral(); }; dialog.Closed += (o, e) => { DidCloseTextBlock.Text = "Closed"; }; var dummy = dialog.ShowAsync(); }
protected override void Dispose(bool disposing) { if (Control != null) { datePicker.DateChanged -= DatePicker_DateChanged; datePicker = null; cancelButton = null; calendarView = null; } base.Dispose(disposing); }
private void Button_Click_Delete(object sender, RoutedEventArgs e) { Windows.UI.Xaml.Controls.Button button = (Windows.UI.Xaml.Controls.Button)sender; System.Diagnostics.Debug.WriteLine("delete" + button.DataContext); if (button.DataContext == null) { return; } Document doc = this.param.App.database.GetDocument((string)button.DataContext); this.param.App.database.Delete(doc); }
protected override void OnElementChanged(ElementChangedEventArgs <NullableDatePicker> e) { base.OnElementChanged(e); if (e.NewElement != null && Control == null) { datePicker = new CalendarDatePicker(); datePicker.CharacterSpacing = (int)Element.CharacterSpacing; datePicker.Date = Element.NullableDate; datePicker.FontSize = Element.FontSize; //datePicker.DateFormat = Element.Format; datePicker.MinDate = Element.MinimumDate; datePicker.MaxDate = Element.MaximumDate; datePicker.PlaceholderText = Element.NullableDatePlaceholder; datePicker.DateChanged += DatePicker_DateChanged; calendarView = new Windows.UI.Xaml.Controls.Grid(); calendarView.SizeChanged += CalendarView_SizeChanged; calendarView.ColumnDefinitions.Add(new Windows.UI.Xaml.Controls.ColumnDefinition() { Width = new Windows.UI.Xaml.GridLength(0, Windows.UI.Xaml.GridUnitType.Auto) }); calendarView.Children.Add(datePicker); Windows.UI.Xaml.Controls.Grid.SetColumn(datePicker, 0); // ONLY ADD CLEAR BUTTON IF DATE IS NULLABLE if (e.NewElement.IsDateNullable) { cancelButton = new Windows.UI.Xaml.Controls.Button() { Content = e.NewElement.CancelContent, Margin = new Windows.UI.Xaml.Thickness(5), Command = new Command( () => datePicker.Date = null, () => datePicker.Date != null) }; calendarView.ColumnDefinitions.Add(new Windows.UI.Xaml.Controls.ColumnDefinition() { Width = new Windows.UI.Xaml.GridLength(0, Windows.UI.Xaml.GridUnitType.Auto) }); calendarView.Children.Add(cancelButton); Windows.UI.Xaml.Controls.Grid.SetColumn(cancelButton, 1); } SetNativeControl(calendarView); } }
public void OpenPopups_Flyouts_Unique() { var button = new Windows.UI.Xaml.Controls.Button(); var flyout = new Flyout(); FlyoutBase.SetAttachedFlyout(button, flyout); WindowHelper.WindowContent = button; Assert.AreEqual(0, VisualTreeHelper.GetOpenPopups(Window.Current).Count); FlyoutBase.ShowAttachedFlyout(button); Assert.AreEqual(1, VisualTreeHelper.GetOpenPopups(Window.Current).Count); flyout.Hide(); Assert.AreEqual(0, VisualTreeHelper.GetOpenPopups(Window.Current).Count); }
protected override void OnElementChanged(ElementChangedEventArgs <Page> e) { base.OnElementChanged(e); var element = e.NewElement; var control = Control; var button = new Button() { Content = "나이키" }; this.SetNativeControl(new InkCanvasPage()); }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///MainPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); criteriaTextBox = (Windows.UI.Xaml.Controls.TextBox) this.FindName("criteriaTextBox"); searchButton = (Windows.UI.Xaml.Controls.Button) this.FindName("searchButton"); resultList = (Windows.UI.Xaml.Controls.ListView) this.FindName("resultList"); }
void AddNativeBindings(NativeBindingGalleryPage page) { if (page.NativeControlsAdded) { return; } StackLayout sl = page.Layout; var txbLabel = new TextBlock { FontSize = 14, FontFamily = new FontFamily("HelveticaNeue") }; var txbBox = new TextBox { FontSize = 14, FontFamily = new FontFamily("HelveticaNeue") }; var btnColor = new Windows.UI.Xaml.Controls.Button { Content = "Toggle Label Color", Height = 80 }; btnColor.Click += (sender, args) => txbLabel.Foreground = new SolidColorBrush(Windows.UI.Colors.Pink); var btnTextBox = new Windows.UI.Xaml.Controls.Button { Content = "Change text textbox", Height = 80 }; btnTextBox.Click += (sender, args) => txbBox.Text = "Hello 2 way native"; txbLabel.SetBinding("Text", new Binding("NativeLabel")); txbBox.SetBinding("Text", new Binding("NativeLabel", BindingMode.TwoWay), "TextChanged"); txbLabel.SetBinding("Foreground", new Binding("NativeLabelColor", BindingMode.TwoWay, new ColorToBrushNativeBindingConverter())); var grd = new StackPanel(); grd.Children.Add(txbLabel); grd.Children.Add(btnColor); sl?.Children.Add(grd.ToView()); sl?.Children.Add(txbBox); sl?.Children.Add(btnTextBox.ToView()); page.NativeControlsAdded = true; }
void UpdateButtonBackgroundColor(Color value) { Brush brush = value.ToBrush(); _minus = GetTemplateChild("Minus") as Windows.UI.Xaml.Controls.Button; _plus = GetTemplateChild("Plus") as Windows.UI.Xaml.Controls.Button; if (_minus != null) { _minus.Background = brush; } if (_plus != null) { _plus.Background = brush; } }
void SetArrows() { if (Element.Orientation == CarouselViewOrientation.Horizontal) { prevBtn = FindVisualChild <Windows.UI.Xaml.Controls.Button>(flipView, "PreviousButtonHorizontal"); nextBtn = FindVisualChild <Windows.UI.Xaml.Controls.Button>(flipView, "NextButtonHorizontal"); } else { prevBtn = FindVisualChild <Windows.UI.Xaml.Controls.Button>(flipView, "PreviousButtonVertical"); nextBtn = FindVisualChild <Windows.UI.Xaml.Controls.Button>(flipView, "NextButtonVertical"); } // TODO: Set BackgroundColor, TintColor and Transparency }
private UWPControls.StackPanel CreateInputStackPanel() { var inputStackPanel = new UWPControls.StackPanel(); UWPControls.Button getTokenButton = new UWPControls.Button(); getTokenButton.Content = "Lấy Facebook Token"; getTokenButton.Width = 300; getTokenButton.HorizontalAlignment = UWPXaml.HorizontalAlignment.Center; getTokenButton.Margin = new UWPXaml.Thickness(10); getTokenButton.SetBinding(UWPControls.Button.CommandProperty, new UWPXaml.Data.Binding() { Source = _viewModel, Path = new UWPXaml.PropertyPath("GetTokenCommand") }); UWPControls.PasswordBox passwordBox = new UWPControls.PasswordBox(); passwordBox.PlaceholderText = "Nhập password"; passwordBox.Width = 300; passwordBox.Margin = new UWPXaml.Thickness(10); passwordBox.PasswordChanged += (o, args) => { _viewModel.UserPassword = passwordBox.Password; }; //Thêm tooltip cho password TextBox UWPControls.ToolTip passwordToolTip = new UWPControls.ToolTip(); passwordToolTip.Content = "Để giảm thiểu khả năng checkpoint và tăng độ bảo mật, các bạn nên dùng Mật khẩu ứng dụng. Để lấy Mật khẩu ứng dụng: Cài đặt > Bảo mật và đăng nhập > Xác thực 2 yếu tố > Mật khẩu ứng dụng"; UWPControls.ToolTipService.SetToolTip(passwordBox, passwordToolTip); UWPControls.TextBox emailTextBox = new UWPControls.TextBox(); emailTextBox.PlaceholderText = "Nhập email"; emailTextBox.IsSpellCheckEnabled = false; emailTextBox.Width = 300; emailTextBox.Margin = new UWPXaml.Thickness(10); //https://github.com/Microsoft/XamlIslandBlogPostSample/blob/master/WpfApp1/BindingPage.xaml.cs emailTextBox.SetBinding(UWPControls.TextBox.TextProperty, new UWPXaml.Data.Binding() { Source = _viewModel, Path = new UWPXaml.PropertyPath("UserEmail"), UpdateSourceTrigger = UWPXaml.Data.UpdateSourceTrigger.PropertyChanged, Mode = UWPXaml.Data.BindingMode.TwoWay }); inputStackPanel.Children.Add(emailTextBox); inputStackPanel.Children.Add(passwordBox); inputStackPanel.Children.Add(getTokenButton); return(inputStackPanel); }
public async Task Should_Close_Open_Flyouts() { var button = new Windows.UI.Xaml.Controls.Button(); var flyout = new Flyout(); FlyoutBase.SetAttachedFlyout(button, flyout); WindowHelper.WindowContent = button; Assert.AreEqual(0, GetNonMessageDialogPopupsCount()); FlyoutBase.ShowAttachedFlyout(button); Assert.AreEqual(1, GetNonMessageDialogPopupsCount()); var messageDialog = new MessageDialog("Should_Close_Open_Popups"); var asyncOperation = messageDialog.ShowAsync(); Assert.AreEqual(0, GetNonMessageDialogPopupsCount()); asyncOperation.Cancel(); }
public async Task Should_Close_Open_Popups() { var button = new Windows.UI.Xaml.Controls.Button(); var flyout = new Flyout(); FlyoutBase.SetAttachedFlyout(button, flyout); WindowHelper.WindowContent = button; Assert.AreEqual(0, VisualTreeHelper.GetOpenPopups(Window.Current).Count); FlyoutBase.ShowAttachedFlyout(button); Assert.AreEqual(1, VisualTreeHelper.GetOpenPopups(Window.Current).Count); var messageDialog = new MessageDialog("Hello"); var asyncOperation = messageDialog.ShowAsync(); Assert.AreEqual(0, VisualTreeHelper.GetOpenPopups(Window.Current).Count); asyncOperation.Cancel(); }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///Copy of RegisterPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); pageRoot = (StreetFoo.Client.UI.Common.LayoutAwarePage) this.FindName("pageRoot"); backButton = (Windows.UI.Xaml.Controls.Button) this.FindName("backButton"); pageTitle = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("pageTitle"); FullScreenLandscape = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenLandscape"); Filled = (Windows.UI.Xaml.VisualState) this.FindName("Filled"); FullScreenPortrait = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenPortrait"); Snapped = (Windows.UI.Xaml.VisualState) this.FindName("Snapped"); }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); _plus = GetTemplateChild("Plus") as Windows.UI.Xaml.Controls.Button; if (_plus != null) { _plus.Click += OnPlusClicked; } _minus = GetTemplateChild("Minus") as Windows.UI.Xaml.Controls.Button; if (_minus != null) { _minus.Click += OnMinusClicked; } UpdateEnabled(Value); }
private async void Button_Click(object sender, RoutedEventArgs args) { dialog = new ContentDialog(); _Button hideButton = new _Button() { Content = new TextBlock() { Name = "HideButton", Text = "Hide" } }; hideButton.Click += HideButton_Click; dialog.Content = hideButton; DidShowAsyncReturnTextBlock.Text = "Not Returned"; var dummy = await dialog.ShowAsync(); DidShowAsyncReturnTextBlock.Text = "Returned"; }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///ItemDetailPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); pageRoot = (_8Tracks.Common.LayoutAwarePage) this.FindName("pageRoot"); itemsViewSource = (Windows.UI.Xaml.Data.CollectionViewSource) this.FindName("itemsViewSource"); flipView = (Windows.UI.Xaml.Controls.FlipView) this.FindName("flipView"); backButton = (Windows.UI.Xaml.Controls.Button) this.FindName("backButton"); pageTitle = (Windows.UI.Xaml.Controls.TextBlock) this.FindName("pageTitle"); ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup) this.FindName("ApplicationViewStates"); FullScreenLandscape = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenLandscape"); Filled = (Windows.UI.Xaml.VisualState) this.FindName("Filled"); FullScreenPortrait = (Windows.UI.Xaml.VisualState) this.FindName("FullScreenPortrait"); Snapped = (Windows.UI.Xaml.VisualState) this.FindName("Snapped"); }