本文整理汇总了C#中Windows.UI.Xaml.Controls.Button类的典型用法代码示例。如果您正苦于以下问题:C# Button类的具体用法?C# Button怎么用?C# Button使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Button类属于Windows.UI.Xaml.Controls命名空间,在下文中一共展示了Button类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: showButtons
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;
}
}
}
示例2: OnApplyTemplate
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;
}
示例3: AsyncTaskUIMethod
public async Task AsyncTaskUIMethod()
{
ExecuteUIThread.RealDelay(1000);
Button b = new Button();
_shouldBeSet = "Yep it is set.";
}
示例4: InitializeComponent
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");
}
示例5: GetNaviButtonControl
private void GetNaviButtonControl()
{
if (this.naviButton == null)
{
this.naviButton = this.GetTemplateChild("NaviButton") as Button;
}
}
示例6: OnApplyTemplate
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();
}
示例7: StartScore
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;
}
示例8: OnApplyTemplate
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
//});
}
示例9: OnNavigatedTo
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;
}
示例10: OnNavigatedTo
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);
}
}
}
示例11: NoteContent
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));
}
}
示例12: HubPage
//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);
}
}
示例13: btn_Click
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);
}
示例14: ButtonValid_Click
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();
}
示例15: InitializeComponent
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");
}