public override async void PerformAction() { AlarmActionTypes desiredAction = this.GetActionFromCommand(); switch (desiredAction) { case AlarmActionTypes.CREATE: var alarm = await this.NewAlarm(); this.ClearArea(); if (this.DynamicArea != null) { RelativePanel panel = CreateAlarmCard(alarm); this.DynamicArea.Children.Add(panel); RelativePanel.SetAlignHorizontalCenterWithPanel(panel, true); RelativePanel.SetAlignVerticalCenterWithPanel(panel, true); } break; case AlarmActionTypes.EDIT: this.EditAlarm(); break; case AlarmActionTypes.DELETE: this.DeleteAlarm(); break; } }
public void LeftOf_Measures_Correctly() { var rect1 = new Rectangle { Height = 20, Width = 20 }; var rect2 = new Rectangle { Height = 20, Width = 20 }; var target = new RelativePanel { VerticalAlignment = Layout.VerticalAlignment.Center, HorizontalAlignment = Layout.HorizontalAlignment.Center, Children = { rect1, rect2 } }; RelativePanel.SetLeftOf(rect2, rect1); target.Measure(new Size(400, 400)); target.Arrange(new Rect(target.DesiredSize)); Assert.Equal(new Size(20, 20), target.Bounds.Size); Assert.Equal(new Rect(0, 0, 20, 20), target.Children[0].Bounds); Assert.Equal(new Rect(-20, 0, 20, 20), target.Children[1].Bounds); }
private void cmbClass_SelectionChanged(object sender, SelectionChangedEventArgs e) { clsChanged = true; var temp = (Class)cmbClass.SelectedItem; if (rpBasicInfo.Children.Contains(addClass)) { rpBasicInfo.Children.Remove(addClass); rpBasicInfo.Children.Remove(txtLevel); rpBasicInfo.Children.Remove(txbLevel); rpBasicInfo.Children.Remove(txtHitPoints); rpBasicInfo.Children.Remove(txbHitPoints); } rpBasicInfo.Children.Remove(cmbSubclass); cmbSubclass.SelectionChanged += CmbSubclass_SelectionChanged;; cmbSubclass.ItemsSource = temp.Archetypes; cmbSubclass.Margin = new Thickness(0, 10, 0, 0); cmbSubclass.Width = 350; cmbSubclass.Height = 50; cmbSubclass.FontSize = 30; RelativePanel.SetAlignRightWithPanel(cmbSubclass, true); RelativePanel.SetBelow(cmbSubclass, sender); rpBasicInfo.Children.Add(cmbSubclass); // Set Saving Throws rbStr.IsChecked = temp.SaveProf[0]; rbDex.IsChecked = temp.SaveProf[1]; rbCon.IsChecked = temp.SaveProf[2]; rbInt.IsChecked = temp.SaveProf[3]; rbWis.IsChecked = temp.SaveProf[4]; rbCha.IsChecked = temp.SaveProf[5]; clsChanged = false; }
private void Scenario2_SizeChanged(object sender, SizeChangedEventArgs e) { bool isCurrentlySmall = e.NewSize.Width < 600; if (isSmall != isCurrentlySmall) { if (isCurrentlySmall) { RelativePanel.SetBelow(tbOverview, imgPoster); RelativePanel.SetAlignLeftWithPanel(tbOverview, true); RelativePanel.SetAlignLeftWithPanel(gridInfo, true); RelativePanel.SetBelow(grCast, gridInfo); lvCredits.ItemTemplate = (DataTemplate)Application.Current.Resources["CastNarrowTemplate"]; } else { RelativePanel.SetAlignLeftWithPanel(tbOverview, false); RelativePanel.SetAlignLeftWithPanel(gridInfo, false); RelativePanel.SetBelow(tbOverview, tbTitle); RelativePanel.SetRightOf(tbOverview, imgPoster); RelativePanel.SetBelow(grCast, imgPoster); lvCredits.ItemTemplate = (DataTemplate)Application.Current.Resources["CastWideTemplate"]; } isSmall = isCurrentlySmall; } }
private void cmbRace_SelectionChanged(object sender, SelectionChangedEventArgs e) { var temp = (Race)cmbRace.SelectedItem; if (temp.Subraces.Count != 0) { cmbSubrace.ItemsSource = ((Race)cmbRace.SelectedItem).Subraces; cmbSubrace.Margin = new Thickness(0, 10, 0, 0); cmbSubrace.Width = 350; cmbSubrace.Height = 50; cmbSubrace.FontSize = 30; cmbSubrace.SelectionChanged += CmbSubrace_SelectionChanged; RelativePanel.SetAlignRightWithPanel(cmbSubrace, true); RelativePanel.SetBelow(cmbSubrace, sender); rpBasicInfo.Children.Add(cmbSubrace); RelativePanel.SetBelow(cmbClass, cmbSubrace); RelativePanel.SetBelow(txtClass, cmbSubrace); SetLanguages(temp); } else { RelativePanel.SetBelow(cmbClass, cmbRace); RelativePanel.SetBelow(txtClass, txtRace); rpBasicInfo.Children.Remove(cmbSubrace); SetAbilityBonuses(temp); SetLanguages(temp); } }
private void RelativePanel_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e) { RelativePanel relative = sender as RelativePanel; Transaction trans = (Transaction)relative.DataContext; budget.AddRepeatTransaction(trans); }
void LoadRoomList() { SettingsModel settingsModel = SettingsModel.GetInstance(); List <string> rooms = settingsModel.Rooms; if (rooms.Count > 0) { foreach (string room in rooms) { RelativePanel relativePanel = new RelativePanel(); relativePanel.Width = 100; TextBlock roomText = new TextBlock(); roomText.Name = "rt" + rooms.IndexOf(room); roomText.Text = room; Button deleteButton = new Button(); RelativePanel.SetAlignRightWithPanel(deleteButton, true); RelativePanel.SetAlignVerticalCenterWith(deleteButton, roomText.Name); TextBlock deleteText = new TextBlock(); deleteText.Text = "\u2573"; deleteText.FontFamily = new FontFamily("Segoe UI Symbol"); deleteText.FontSize = 12; deleteText.Height = 20; deleteButton.Name = "db" + rooms.IndexOf(room); deleteButton.Click += new RoutedEventHandler(DeleteButton_Click); deleteButton.Content = deleteText; relativePanel.Children.Add(roomText); relativePanel.Children.Add(deleteButton); roomList.Items.Add(relativePanel); } } }
private void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e) { var selected = (sender as Pivot).SelectedIndex; RelativePanel tab = null; switch (selected) { case 0: { tab = tab0; break; } } List <RelativePanel> l = new List <RelativePanel> { tab0 }; foreach (RelativePanel t in l) { (t.Children[0] as TextBlock).Foreground = new SolidColorBrush(Colors.White); (t.Children[1] as Rectangle).Fill = new SolidColorBrush(Colors.White); } (tab.Children[0] as TextBlock).Foreground = new SolidColorBrush(Colors.Black); (tab.Children[1] as Rectangle).Fill = new SolidColorBrush(Colors.Black); }
private async void CartaSelectPanel_Tapped(object sender, TappedRoutedEventArgs e) { if (myApp.miTurno) { await _dispatcher.RunAsync(CoreDispatcherPriority.Low, () => { Storyboard myStory = new Storyboard(); RelativePanel clickedElement = sender as RelativePanel; clsCarta miCarta = clickedElement.DataContext as clsCarta; clsCarta miCartaV2 = vm.listadoDeCartas[miCarta.idCarta]; Object value = null; if (!miCartaV2.estaBajada) { clickedElement?.Resources.TryGetValue("revelaImagen", out value); } else { clickedElement?.Resources.TryGetValue("volteaImagen", out value); } myStory = value as Storyboard; myStory?.Begin(); }); } }
public void Lays_Out_1_Child_Next_the_other() { var rect1 = new Rectangle { Height = 20, Width = 20 }; var rect2 = new Rectangle { Height = 20, Width = 20 }; var target = new RelativePanel { VerticalAlignment = Layout.VerticalAlignment.Top, HorizontalAlignment = Layout.HorizontalAlignment.Left, Children = { rect1, rect2 } }; RelativePanel.SetAlignLeftWithPanel(rect1, true); RelativePanel.SetRightOf(rect2, rect1); target.Measure(new Size(400, 400)); target.Arrange(new Rect(target.DesiredSize)); Assert.Equal(new Size(40, 20), target.Bounds.Size); Assert.Equal(new Rect(0, 0, 20, 20), target.Children[0].Bounds); Assert.Equal(new Rect(20, 0, 20, 20), target.Children[1].Bounds); }
/// <summary> /// Создает, отрисовывает и добавляет в контейнер панель с информацией о контрагенте /// </summary> /// <param name="c"></param> private void AddContractorPanel(Contractor c) { RelativePanel panel = new RelativePanel(); Image contractorImage = new Image(); contractorImage.Source = c.Photo ?? placeHolder; contractorImage.MaxWidth = contractorImage.MaxHeight = 50; contractorImage.Margin = new Thickness(5, 5, 5, 5); TextBlock contractorName = new TextBlock(); contractorName.Text = c.Name; contractorName.VerticalAlignment = VerticalAlignment.Center; contractorName.HorizontalAlignment = HorizontalAlignment.Stretch; contractorName.TextWrapping = TextWrapping.WrapWholeWords; RelativePanel.SetRightOf(contractorName, contractorImage); panel.Margin = new Thickness(2, 5, 2, 5); panel.BorderBrush = new SolidColorBrush(Colors.Black); panel.BorderThickness = new Thickness(3); panel.MaxHeight = 60; panel.Width = mainGrid.ColumnDefinitions[1].ActualWidth - panel.Margin.Right; panel.PointerPressed += contractorPressedEvent; panel.Tag = c.ID; panel.Children.Add(contractorImage); panel.Children.Add(contractorName); panel.Background = new SolidColorBrush(Colors.White); RowDefinition newRow = new RowDefinition(); newRow.MaxHeight = 70; contractorsList.RowDefinitions.Add(newRow); Grid.SetRow(panel, rowIndex++); contractorsList.Children.Add(panel); }
/// <summary> /// Performs our action and sets the media Element and the Dynamic Area for our action to use. /// </summary> /// <param name="element"></param> /// <param name="dynamicArea"></param> /// <seealso cref="PerformAction"/> /// <seealso cref="PerformAction(MediaElement)"/> public void PerformAction(MediaElement element, RelativePanel dynamicArea) { this.DynamicArea = dynamicArea; this.DynamicArea.Children.Clear(); this.ShowLoading(); this.PerformAction(element); }
/// <summary> /// Sets the background of the city tile to aqua and the cursor to the hand /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void City_Tile_Panel_PointerEntered(object sender, PointerRoutedEventArgs e) { RelativePanel p = (RelativePanel)sender; p.Background = new SolidColorBrush(Colors.Aqua); Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Hand, 0); }
/// <summary> /// Adds the city adding tile to the list of cities /// </summary> private void AddCityAddingTile() { //Add city adding icon Image img = new Image { Source = new BitmapImage(new System.Uri("ms-appx:///Assets/add.png")), Width = 100, Height = 100 }; img.SetValue(RelativePanel.AlignHorizontalCenterWithPanelProperty, true); img.SetValue(RelativePanel.AlignVerticalCenterWithPanelProperty, true); //Create new panel RelativePanel panel = new RelativePanel { Height = 200, Width = 200, Margin = new Thickness(5), BorderThickness = new Thickness(1), BorderBrush = new SolidColorBrush(Colors.Aqua) }; panel.Children.Add(img); //Add mouse hover effect panel.PointerEntered += City_Tile_Panel_PointerEntered; panel.PointerExited += City_Tile_Panel_PointerExited; panel.Tapped += this.rlpAddLocation_Tapped; spCities.Children.Add(panel); }
public void RelativePanel_Can_Center() { using var app = UnitTestApplication.Start(TestServices.MockPlatformRenderInterface); var rect1 = new Rectangle { Height = 20, Width = 20 }; var rect2 = new Rectangle { Height = 20, Width = 20 }; var target = new RelativePanel { VerticalAlignment = Layout.VerticalAlignment.Center, HorizontalAlignment = Layout.HorizontalAlignment.Center, Children = { rect1, rect2 } }; RelativePanel.SetAlignLeftWithPanel(rect1, true); RelativePanel.SetBelow(rect2, rect1); target.Measure(new Size(400, 400)); target.Arrange(new Rect(target.DesiredSize)); Assert.Equal(new Size(20, 40), target.Bounds.Size); Assert.Equal(new Rect(0, 0, 20, 20), target.Children[0].Bounds); Assert.Equal(new Rect(0, 20, 20, 20), target.Children[1].Bounds); }
/// <summary> /// Used to render each ListView item, obtain the handoff Visual, /// and wire up the per item parallax ExpressionAnimations. /// </summary> /// <param name="sender">The ListView</param> /// <param name="args">ContainerContentChangingEventArgs</param> private void ListView_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { // Obtain the backing data item Album album = args.Item as Album; // Find the UIElements in the DataTemplate and update their respective values RelativePanel panel = args.ItemContainer.ContentTemplateRoot as RelativePanel; // Since we defined the template in markup we know that // the Canvas is the first child of the RelativePanel // and the Image is the first child of the Canvas so we // can directly index to them Canvas canvas = panel.Children[0] as Canvas; Image image = canvas.Children[0] as Image; image.Source = new BitmapImage(new Uri(album.ImageUrl + "&w=960&h=960")); // Get the handoff visual of UIElement // Initialize values for the Size and Offset Visual sprite = ElementCompositionPreview.GetElementVisual(image); sprite.Size = new Vector2(960f, 960f); sprite.Offset = new Vector3(0f, 0f, 0f); // Update the scalar parameter of the Visual starting offset _perItemParallax.SetScalarParameter("StartOffset", (float)args.ItemIndex * sprite.Size.Y / 4.0f); sprite.StartAnimation("Offset.Y", _perItemParallax); args.Handled = true; }
public void StretchedPanel_Measures_Correctly(double availableWidth, double availableHeight, double desiredWidth, double desiredHeight) { using var app = UnitTestApplication.Start(TestServices.MockPlatformRenderInterface); var rect1 = new Rectangle { Height = 20, Width = 20 }; var rect2 = new Rectangle { Height = 20, Width = 20 }; var target = new RelativePanel { VerticalAlignment = Layout.VerticalAlignment.Stretch, HorizontalAlignment = Layout.HorizontalAlignment.Stretch, Children = { rect1, rect2 } }; RelativePanel.SetBelow(rect2, rect1); target.Measure(new Size(availableWidth, availableHeight)); target.Arrange(new Rect(target.DesiredSize)); Assert.Equal(desiredWidth, target.DesiredSize.Width); Assert.Equal(desiredHeight, target.DesiredSize.Height); }
protected override void OnNavigatedTo(NavigationEventArgs e) { if (e.Parameter == null) { return; } contest = e.Parameter as Contest; title.Text = contest.name; Dateo.Text = "Start Date"; Date.Text = contest.startDate.ToString(); int hours = contest.durationSeconds / 3600; int min = (contest.durationSeconds - hours * 3600) / 60; Durationo.Text = "Duration Time"; Duration.Text = hours.ToString() + " hour " + min.ToString() + " min "; RemainDateo.Text = "Remain Date"; TimeSpan diff = (DateTime.Now - contest.startDate).Negate(); RemainDate.Text = string.Format("{0:%d} days {0:%h} hours {0:%m} minutes ", diff) + (diff < TimeSpan.Zero?"Passed":"Left"); AppBarButton buttonForRegist = new AppBarButton(); buttonForRegist.Icon = new SymbolIcon(Symbol.Flag); buttonForRegist.Click += Regist_click; buttonForRegist.Label = "Alarm Me!"; panel.Children.Add(buttonForRegist); RelativePanel.SetAlignBottomWithPanel(buttonForRegist, true); RelativePanel.SetAlignRightWithPanel(buttonForRegist, true); }
private void KeyboardStandardLayout_DropDownClosed(object sender, object e) { if (this.CurrentlyEditingFnKey != null) { this.CurrentlyEditingFnKey.Visibility = Visibility.Visible; RelativePanel parent = (RelativePanel)CurrentlyEditingFnKey.Parent; var button_idx = parent.Children.IndexOf(CurrentlyEditingFnKey); if (button_idx != 0) { RelativePanel.SetRightOf(CurrentlyEditingFnKey, parent.Children[parent.Children.IndexOf(CurrentlyEditingFnKey) - 1]); } if (button_idx != parent.Children.Count - 2) { RelativePanel.SetRightOf(parent.Children[parent.Children.IndexOf(CurrentlyEditingFnKey) + 1], CurrentlyEditingFnKey); } } if (this.CurrentlyEditingStandardKey != null) { this.CurrentlyEditingStandardKey.Visibility = Visibility.Visible; RelativePanel parent = (RelativePanel)CurrentlyEditingStandardKey.Parent; var button_idx = parent.Children.IndexOf(CurrentlyEditingStandardKey); if (button_idx != 0) { RelativePanel.SetRightOf(CurrentlyEditingStandardKey, parent.Children[parent.Children.IndexOf(CurrentlyEditingStandardKey) - 1]); } if (button_idx != parent.Children.Count - 2) { RelativePanel.SetRightOf(parent.Children[parent.Children.IndexOf(CurrentlyEditingStandardKey) + 1], CurrentlyEditingStandardKey); } } this.keyboardLayoutSelection.Visibility = Visibility.Collapsed; }
//获取最后的文件 public async void SavePanelPic(RelativePanel relativePanel) { string desiredName = DateTime.Now.Ticks + ".jpg"; StorageFolder applicationFolder = KnownFolders.PicturesLibrary; StorageFolder folder = await applicationFolder.CreateFolderAsync("PicExports", CreationCollisionOption.OpenIfExists); StorageFile saveFile = await folder.CreateFileAsync(desiredName, CreationCollisionOption.OpenIfExists); RenderTargetBitmap bitmap = new RenderTargetBitmap(); await bitmap.RenderAsync(relativePanel); var pixelBuffer = await bitmap.GetPixelsAsync(); using (var fileStream = await saveFile.OpenAsync(FileAccessMode.ReadWrite)) { var encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.PngEncoderId, fileStream); encoder.SetPixelData(BitmapPixelFormat.Bgra8, BitmapAlphaMode.Ignore, (uint)bitmap.PixelWidth, (uint)bitmap.PixelHeight, DisplayInformation.GetForCurrentView().LogicalDpi, DisplayInformation.GetForCurrentView().LogicalDpi, pixelBuffer.ToArray()); await encoder.FlushAsync(); } }
/// <summary> /// Builds a relative panel containing the details of a voice memo /// </summary> /// <param name="voiceMemo">The voice memo to build the panel for</param> /// <param name="audioRecorder">The object that will play the voice memo's audio</param> /// <param name="DeleteCallBack">the callback function for when the voice memo's delete button is clicked</param> /// <returns></returns> public static RelativePanel BuildVoiceMemoPanel(VoiceMemo voiceMemo, AudioRecorder audioRecorder, Action DeleteCallBack = null) { var panel = new RelativePanel(); panel.Margin = new Thickness(0, 10, 0, 10); var ellipse = BuildMemoEllipse(); var titleBlock = BuildTitleBlock(voiceMemo); var durationBlock = BuildDurationBlock(voiceMemo); var dateRecordedBlock = BuildDateRecordedBlock(voiceMemo); var deleteButton = BuildDeleteButton(voiceMemo, audioRecorder, DeleteCallBack); var playbackButton = BuildPlayBackButton(voiceMemo, audioRecorder); panel.Children.Add(ellipse); panel.Children.Add(titleBlock); panel.Children.Add(durationBlock); panel.Children.Add(dateRecordedBlock); panel.Children.Add(deleteButton); panel.Children.Add(playbackButton); // position the elements within the panel RelativePanel.SetRightOf(titleBlock, ellipse); RelativePanel.SetAlignVerticalCenterWith(titleBlock, ellipse); RelativePanel.SetBelow(durationBlock, titleBlock); RelativePanel.SetAlignLeftWith(durationBlock, titleBlock); RelativePanel.SetBelow(dateRecordedBlock, durationBlock); RelativePanel.SetAlignLeftWith(dateRecordedBlock, durationBlock); RelativePanel.SetBelow(deleteButton, dateRecordedBlock); RelativePanel.SetAlignBottomWithPanel(deleteButton, true); RelativePanel.SetAlignLeftWithPanel(deleteButton, true); RelativePanel.SetBelow(playbackButton, dateRecordedBlock); RelativePanel.SetAlignBottomWithPanel(playbackButton, true); RelativePanel.SetAlignRightWithPanel(playbackButton, true); return(panel); }
public override async void PerformAction() { ReminderActionTypes desiredAction = this.GetActionFromCommand(); switch (desiredAction) { case ReminderActionTypes.CREATE: var reminder = await this.NewReminderAsync(); // if the reminder is null, don't do anything if (reminder != null) { this.ClearArea(); if (this.DynamicArea != null) { RelativePanel panel = this.CreateReminderCard(reminder); this.DynamicArea.Children.Add(panel); RelativePanel.SetAlignHorizontalCenterWithPanel(panel, true); RelativePanel.SetAlignVerticalCenterWithPanel(panel, true); } } break; case ReminderActionTypes.EDIT: this.EditReminder(); break; case ReminderActionTypes.DELETE: this.DeleteReminder(); break; } }
private void AddAlarmToScreen(Alarm AlarmToAdd) { // each alarm is wrapped in a relative panel RelativePanel alarmPanel = new RelativePanel(); alarmPanel.Margin = new Thickness(5, 0, 5, 5); var borderBrush = new SolidColorBrush(Windows.UI.Colors.Gray); alarmPanel.BorderBrush = borderBrush; alarmPanel.BorderThickness = new Thickness(1); // create the text blocks for the title and date var alarmTitleBlock = this.CreateAlarmTitleBlock(AlarmToAdd); var alarmDateBlock = this.CreateAlarmDateBlock(AlarmToAdd); var deleteButton = this.CreateDeleteButton(AlarmToAdd); var editButton = this.CreateEditButton(AlarmToAdd); // add the blocks and buttons alarmPanel.Children.Add(alarmTitleBlock); alarmPanel.Children.Add(alarmDateBlock); alarmPanel.Children.Add(deleteButton); alarmPanel.Children.Add(editButton); // relatively place the edit text block RelativePanel.SetBelow(alarmDateBlock, alarmTitleBlock); // relatively place the delete button RelativePanel.SetAlignBottomWithPanel(deleteButton, true); RelativePanel.SetAlignLeftWithPanel(deleteButton, true); RelativePanel.SetBelow(deleteButton, alarmDateBlock); RelativePanel.SetLeftOf(deleteButton, editButton); // relatively place the edit button RelativePanel.SetAlignBottomWithPanel(editButton, true); RelativePanel.SetAlignRightWithPanel(editButton, true); RelativePanel.SetBelow(editButton, alarmDateBlock); this.VariableGrid.Children.Add(alarmPanel); }
private void SetUpUI() { this.StartRecordingButton = VoiceMemoUIHelper.BuildStartRecordingButton(this.StartRecording); this.StopRecordingButton = VoiceMemoUIHelper.BuildStopRecordingButton(this.StopRecording); this.SaveRecordingButton = VoiceMemoUIHelper.BuildSaveRecordingButton(this.SaveRecording); this.DeleteRecordingButton = VoiceMemoUIHelper.BuildDeleteRecordingButton(this.DeleteRecording); this.RecordingNameBox = VoiceMemoUIHelper.BuildDisplayNameTextBox(); // relatively place all the components RelativePanel.SetAlignVerticalCenterWithPanel(StartRecordingButton, true); RelativePanel.SetAlignHorizontalCenterWithPanel(StartRecordingButton, true); RelativePanel.SetAlignVerticalCenterWithPanel(StopRecordingButton, true); RelativePanel.SetAlignHorizontalCenterWithPanel(StopRecordingButton, true); RelativePanel.SetAlignVerticalCenterWithPanel(SaveRecordingButton, true); RelativePanel.SetAlignHorizontalCenterWithPanel(SaveRecordingButton, true); RelativePanel.SetAlignVerticalCenterWithPanel(DeleteRecordingButton, true); RelativePanel.SetAlignHorizontalCenterWithPanel(DeleteRecordingButton, true); // place the save and delete buttons next to each other RelativePanel.SetLeftOf(DeleteRecordingButton, SaveRecordingButton); // place the text box below the save button RelativePanel.SetBelow(RecordingNameBox, SaveRecordingButton); RelativePanel.SetAlignLeftWith(RecordingNameBox, SaveRecordingButton); RelativePanel.SetAlignRightWith(RecordingNameBox, SaveRecordingButton); // hide all our buttons except the start recording one this.ResetUIComponents(); // now add everything to the dynamic area this.DynamicArea.Children.Add(StartRecordingButton); this.DynamicArea.Children.Add(StopRecordingButton); this.DynamicArea.Children.Add(SaveRecordingButton); this.DynamicArea.Children.Add(DeleteRecordingButton); this.DynamicArea.Children.Add(RecordingNameBox); }
private void HideNowPlayingAnimation() { EventPanel.Visibility = Visibility.Visible; PlaybackControlPanelBorder.Visibility = Visibility.Visible; BottomArea.Height = BottomArea.ActualHeight; RelativePanel.SetAlignTopWithPanel(BottomArea, false); var sb = Resources["HideNowPlayingStoryboard"] as Storyboard; var animation = sb.Children[0] as DoubleAnimationUsingKeyFrames; var keyframe = animation.KeyFrames[0] as SplineDoubleKeyFrame; keyframe.Value = 60; var cpAnimation = sb.Children[1] as DoubleAnimation; cpAnimation.From = PlaybackControlPanel.Opacity; var npAnimation = sb.Children[2] as DoubleAnimation; npAnimation.From = NowPlayingPage.Opacity; DisableManipulation(); sb.Begin(); sb.Completed += OnHideNowPlayingStoryboardCompleted; }
/// <summary> /// Add module menu into page /// </summary> /// <param name="container">COntainer</param> public virtual void AddModuleMenu(Panel container) { if (container == null) { throw new ArgumentNullException("Parameter container is null."); } var pageHeader = container.Children.FirstOrDefault(x => (x as FrameworkElement).Name == "PageHeader"); DropShadowPanel ShadowPanel = new DropShadowPanel { Style = ApplicationBase.Current.Resources["ShadowContent"] as Style, HorizontalContentAlignment = HorizontalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Stretch }; RelativePanel.SetBelow(ShadowPanel, pageHeader); RelativePanel.SetAlignBottomWithPanel(ShadowPanel, true); RelativePanel.SetAlignRightWithPanel(ShadowPanel, true); RelativePanel.SetAlignLeftWithPanel(ShadowPanel, true); Grid ContentGrid = new Grid { Style = ApplicationBase.Current.Resources["ContentGrid"] as Style }; RowDefinition RowMain = new RowDefinition(); RowDefinition MinorUpdateRow = new RowDefinition(); ValueWhenConverter boolToGridLength = new ValueWhenConverter { When = true, Value = new GridLength(50), Otherwise = new GridLength(0) }; Binding minorUpdateRowBinding = new Binding { Source = (DataContext as MainPageVMBase).ShowMinorUpdate, Mode = BindingMode.OneWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Converter = boolToGridLength }; BindingOperations.SetBinding(MinorUpdateRow, RowDefinition.HeightProperty, minorUpdateRowBinding); var MPVMB = DataContext as MainPageVMBase; ApplicationBase.Current.PropertyChangedNotifier.RegisterProperty(MinorUpdateRow, RowDefinition.HeightProperty, nameof(MPVMB.ShowMinorUpdate), viewModelType, converter: boolToGridLength); ContentGrid.RowDefinitions.Add(RowMain); ContentGrid.RowDefinitions.Add(MinorUpdateRow); AddMenuList(ContentGrid); AddMinorUpdateRow(ContentGrid); ShadowPanel.Content = ContentGrid; container.Children.Add(ShadowPanel); }
/// <summary> /// Add minor update notification row /// </summary> /// <param name="moduleMenu">Module menu panel</param> private void AddMinorUpdateRow(Panel moduleMenu) { RelativePanel MinorUpdatePanel = new RelativePanel(); Grid.SetRow(MinorUpdatePanel, 1); DropShadowPanel MinorUpdateShadow = new DropShadowPanel { Style = ApplicationBase.Current.Resources["ShadowContent"] as Style, HorizontalContentAlignment = HorizontalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Stretch }; RelativePanel.SetAlignTopWithPanel(MinorUpdateShadow, true); RelativePanel.SetAlignBottomWithPanel(MinorUpdateShadow, true); RelativePanel.SetAlignRightWithPanel(MinorUpdateShadow, true); RelativePanel.SetAlignLeftWithPanel(MinorUpdateShadow, true); Grid MinorUpdateContent = new Grid { Style = ApplicationBase.Current.Resources["ContentGrid"] as Style, HorizontalAlignment = HorizontalAlignment.Stretch }; Button MinorUpdateClose = new Button { Background = new SolidColorBrush(Windows.UI.Colors.Transparent), Content = "", Height = 40, Width = 40, FontFamily = new FontFamily("Segoe MDL2 Assets"), VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Right, HorizontalContentAlignment = HorizontalAlignment.Center, VerticalContentAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, 10, 0) }; Binding minorUpdateCloseBinding = new Binding { Source = (DataContext as MainPageVMBase).CloseMinor }; BindingOperations.SetBinding(MinorUpdateClose, Button.CommandProperty, minorUpdateCloseBinding); TextBlock MinorUpdateText = new TextBlock { Text = "Your app has been udpated to version " + (DataContext as MainPageVMBase).CurrentVersion, Margin = new Thickness(10, 10, 50, 10), VerticalAlignment = VerticalAlignment.Center }; MinorUpdateContent.Children.Add(MinorUpdateClose); MinorUpdateContent.Children.Add(MinorUpdateText); MinorUpdateShadow.Content = MinorUpdateContent; MinorUpdatePanel.Children.Add(MinorUpdateShadow); moduleMenu.Children.Add(MinorUpdatePanel); }
private void gv_ItemClick(object sender, ItemClickEventArgs e) { RelativePanel rp = (RelativePanel)e.ClickedItem; TextBlock tb = (TextBlock)rp.Children[2]; VolPage.vol = tb.Text.Split(' ')[0].Split('.')[1]; Frame.Navigate(typeof(VolPage)); }
private void BeginRelativePanel_Tapped(object sender, TappedRoutedEventArgs e) { var colorBrush = new SolidColorBrush(Color.FromArgb(170, 0, 0, 0)); RelativePanel panel = sender as RelativePanel; panel.Background = colorBrush; this.Frame.Navigate(typeof(GamePage)); }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); _visualPanel = (RelativePanel)GetTemplateChild("VisualPanel"); _symbol = (ContentControl)GetTemplateChild("Symbol"); _symbolView = (Viewbox)GetTemplateChild("SymbolView"); _contentPresenter = (ContentPresenter)GetTemplateChild("ContentPresenter"); }
public void Add(RelativePanel child,double itemWidth) { _child = child; child.SetValue(RelativePanel.AlignLeftWithPanelProperty,true); child.SetValue(RelativePanel.AlignTopWithPanelProperty,true); child.SetValue(RelativePanel.AlignBottomWithPanelProperty,true); child.SetValue(RelativePanel.AlignRightWithPanelProperty,true); this._slideStepWidth = itemWidth; this.Background = child.Background; _buttonLeft.Height = _buttonRight.Height = _panelLeft.Height = _panelRight.Height = this.Height = child.Height; _buttonLeft.Width = _buttonRight.Width = 30; _buttonLeft.Click += _buttonLeft_Click; _buttonRight.Click += _buttonRight_Click; child.SetValue(RelativePanel.AlignTopWithPanelProperty,true); _panelLeft.Children.Add(_buttonLeft); _panelRight.Children.Add(_buttonRight); this.Children.Add(child); this.Children.Add(_panelLeft); this.Children.Add(_panelRight); }
private void TranslateButton(TranslationConfigs translationConfig, string _language, string _package, Button _packageButton, RelativePanel _packagePanel) { if (translationConfig.PackageExistsForLanguage(_language, _package)) { _packagePanel.Visibility = Visibility.Visible; _packageButton.Content = translationConfig.GetPackageTitleTranslation(_language, _package); } else { _packagePanel.Visibility = Visibility.Collapsed; } }
private void InsertOrders(OrderType type) { orderGrid.Children.Clear(); orderGrid.RowDefinitions.Clear(); orderGrid.ColumnDefinitions.Clear(); List<OrderInfo> orders = null; switch(type) { case OrderType.NOT_PAY: orders = notPayOrders; break; case OrderType.PAYED: orders = payedOrders; break; case OrderType.COMPLETED: orders = completedOrders; break; default: break; } if(null == orders) { return; } int count = orders.Count; for(int i=0; i<count; i++) { RowDefinition row = new RowDefinition(); //row.Height = new GridLength(orderGridSizeInfo.orderGridHeight); orderGrid.RowDefinitions.Add(row); } int nRow = 0; foreach(var item in orders) { Grid oneOrderGrid = new Grid(); oneOrderGrid.Background = new SolidColorBrush(Color.FromArgb(255,235,235,235)); //Init four panels RelativePanel topPanel = new RelativePanel(); topPanel.Background = new SolidColorBrush(Color.FromArgb(255,241,241,241)); topPanel.Height = orderGridSizeInfo.infoPanelHeight + orderGridSizeInfo.margin; topPanel.Width = infoPanel.Width; Grid.SetColumn(topPanel, 0); Grid.SetRow(topPanel, 0); oneOrderGrid.Children.Add(topPanel); RelativePanel addressPanel = new RelativePanel(); addressPanel.Height = orderGridSizeInfo.infoPanelHeight + orderGridSizeInfo.margin; addressPanel.Width = infoPanel.Width; addressPanel.Background = new SolidColorBrush(Color.FromArgb(255, 241, 241, 241)); Grid.SetColumn(addressPanel, 0); Grid.SetRow(addressPanel, 2); oneOrderGrid.Children.Add(addressPanel); //goods panel RelativePanel goodsGridPanel = new RelativePanel(); goodsGridPanel.Background = new SolidColorBrush(Color.FromArgb(255, 235, 235, 235)); //goodsGridPanel.Width = infoPanel.Width; goodsGridPanel.Height = orderGridSizeInfo.goodsPicHeight + 4 * orderGridSizeInfo.margin + orderGridSizeInfo.infoPanelHeight*2; //SlidePanel slidePanel = new SlidePanel(infoPanel.Width); //slidePanel.Add(goodsGridPanel,orderGridSizeInfo.goodsPicWidth); //Grid.SetColumn(slidePanel, 0); //Grid.SetRow(slidePanel, 1); //oneOrderGrid.Children.Add(slidePanel); //Grid.SetColumn(goodsGridPanel, 0); //Grid.SetRow(goodsGridPanel, 1); //oneOrderGrid.Children.Add(goodsGridPanel); RelativePanel buttonPanel = new RelativePanel(); buttonPanel.Background = new SolidColorBrush(Color.FromArgb(255, 241, 241, 241)); buttonPanel.Width = infoPanel.Width; buttonPanel.Height = orderGridSizeInfo.infoPanelHeight + orderGridSizeInfo.margin*2; Grid.SetColumn(buttonPanel, 0); Grid.SetRow(buttonPanel, 3); buttonPanel.VerticalAlignment = VerticalAlignment.Top; oneOrderGrid.Children.Add(buttonPanel); RowDefinition topRow = new RowDefinition(); topRow.Height = new GridLength(topPanel.Height); oneOrderGrid.RowDefinitions.Add(topRow); RowDefinition goodsGridRow = new RowDefinition(); goodsGridRow.Height = new GridLength(goodsGridPanel.Height); oneOrderGrid.RowDefinitions.Add(goodsGridRow); RowDefinition addressRow = new RowDefinition(); addressRow.Height = new GridLength(addressPanel.Height); oneOrderGrid.RowDefinitions.Add(addressRow); RowDefinition buttonRow = new RowDefinition(); buttonRow.Height = new GridLength(buttonPanel.Height + orderGridSizeInfo.margin); oneOrderGrid.RowDefinitions.Add(buttonRow); #region order info panel items TextBlock topLeft = new TextBlock(); topLeft.Width = 80; topLeft.Height = orderGridSizeInfo.infoPanelHeight; topLeft.Text = "订单号"; topLeft.Foreground = new SolidColorBrush(Color.FromArgb(255,51,51,51)); topLeft.Margin = new Thickness(20, 0, 0, 0); topLeft.SetValue(RelativePanel.AlignLeftWithPanelProperty,true); topLeft.SetValue(RelativePanel.AlignBottomWithPanelProperty, true); topPanel.Children.Add(topLeft); TextBlock topRight = new TextBlock(); topRight.Width = 150; topRight.Height = orderGridSizeInfo.infoPanelHeight; topRight.Text = item.id; topRight.Foreground = new SolidColorBrush(Color.FromArgb(255, 51, 51, 51)); topRight.Margin = new Thickness(0, 0, 20, 0); topRight.SetValue(RelativePanel.AlignRightWithPanelProperty, true); topRight.SetValue(RelativePanel.AlignBottomWithPanelProperty, true); topRight.TextAlignment = TextAlignment.Right; topPanel.Children.Add(topRight); #endregion #region address panel item TextBlock addressLeft = new TextBlock(); addressLeft.Width = topPanel.Width / 2; addressLeft.Height = orderGridSizeInfo.infoPanelHeight; addressLeft.Margin = new Thickness(20,0,0,0); addressLeft.Text = "配送地址"; addressLeft.Foreground = new SolidColorBrush(Color.FromArgb(255, 51, 51, 51)); addressLeft.SetValue(RelativePanel.AlignLeftWithPanelProperty, true); addressLeft.SetValue(RelativePanel.AlignBottomWithPanelProperty, true); addressPanel.Children.Add(addressLeft); TextBlock addressRight = new TextBlock(); addressRight.Width = 150; addressRight.Height = orderGridSizeInfo.infoPanelHeight; addressRight.Text = item.address; addressRight.Foreground = new SolidColorBrush(Color.FromArgb(255, 51, 51, 51)); addressRight.Margin = new Thickness(0,0,20,0); addressRight.TextAlignment = TextAlignment.Right; addressRight.SetValue(RelativePanel.AlignRightWithPanelProperty, true); addressRight.SetValue(RelativePanel.AlignBottomWithPanelProperty, true); addressPanel.Children.Add(addressRight); #endregion #region button panel item TextBlock priceText = new TextBlock(); priceText.Width = 12; priceText.Height = 20; priceText.Text = "¥"; priceText.Name = "priceText"; priceText.Foreground = new SolidColorBrush(Color.FromArgb(255,253,40,3)); priceText.TextAlignment = TextAlignment.Left; priceText.SetValue(RelativePanel.AlignLeftWithPanelProperty, true); priceText.SetValue(RelativePanel.AlignHorizontalCenterWithPanelProperty, true); priceText.Margin = new Thickness(17, 0, 0, -32); buttonPanel.Children.Add(priceText); TextBlock priceNumberText = new TextBlock(); priceNumberText.Width = 70; priceNumberText.Height = orderGridSizeInfo.infoPanelHeight; priceNumberText.Text = item.price; priceNumberText.Foreground = new SolidColorBrush(Colors.Red); priceNumberText.FontSize = 20; priceNumberText.TextAlignment = TextAlignment.Left; priceNumberText.SetValue(RelativePanel.RightOfProperty, "priceText"); priceNumberText.SetValue(RelativePanel.AlignHorizontalCenterWithPanelProperty, true); priceNumberText.Margin = new Thickness(3, 0, 0, 0); buttonPanel.Children.Add(priceNumberText); Button btnPay = new Button(); if (item.payed.Equals("true")) { btnPay.Visibility = Visibility.Collapsed; } btnPay.Width = 100; btnPay.Height = orderGridSizeInfo.infoPanelHeight; btnPay.VerticalContentAlignment = VerticalAlignment.Center; btnPay.HorizontalContentAlignment = HorizontalAlignment.Center; btnPay.BorderThickness = new Thickness(0); btnPay.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 255, 78, 0)); btnPay.Name = "btnPay"; TextBlock btnPayText = new TextBlock(); btnPayText.Text = "进行付款"; btnPayText.Foreground = new SolidColorBrush(Colors.White); btnPay.Content = btnPayText; //btnPay.Foreground = new SolidColorBrush(Colors.White); btnPay.Background = new SolidColorBrush(Color.FromArgb(255,255,78,0)); btnPay.SetValue(RelativePanel.AlignRightWithPanelProperty,true); btnPay.SetValue(RelativePanel.AlignHorizontalCenterWithPanelProperty, true); btnPay.Margin = new Thickness(0, 0, 20, 0); buttonPanel.Children.Add(btnPay); Button btnCancel = new Button(); btnCancel.Width = 100; btnCancel.Height = orderGridSizeInfo.infoPanelHeight; btnCancel.VerticalContentAlignment = VerticalAlignment.Center; btnCancel.HorizontalContentAlignment = HorizontalAlignment.Center; //btnCancel.Content = "取消订单"; TextBlock btnCancelText = new TextBlock(); btnCancelText.Text = "取消订单"; btnCancelText.Foreground = new SolidColorBrush(Colors.White); btnCancel.Content = btnCancelText; btnCancel.BorderThickness = new Thickness(0); btnCancel.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 148, 148, 148)); //btnCancel.Foreground = new SolidColorBrush(Colors.White); btnCancel.Background = new SolidColorBrush(Color.FromArgb(255,148,148,148)); btnCancel.Margin = new Thickness(0, 0, 5, 0); btnCancel.SetValue(RelativePanel.LeftOfProperty, "btnPay"); btnCancel.SetValue(RelativePanel.AlignHorizontalCenterWithPanelProperty, true); buttonPanel.Children.Add(btnCancel); #endregion #region goods detail panel item int goodsCount = item.goodsList.Count; double goodsGridPanelWidth = 0; for(int i=0; i< goodsCount; i++) { RelativePanel goodsItemPanel = new RelativePanel(); goodsItemPanel.Background = new SolidColorBrush(Color.FromArgb(255,224,224,224)); goodsItemPanel.SetValue(RelativePanel.AlignLeftWithPanelProperty,true); goodsItemPanel.Margin = new Thickness(goodsGridPanelWidth + orderGridSizeInfo.margin,0,0,0); //goods name TextBlock goodsNameText = new TextBlock(); goodsNameText.Width = 60; goodsNameText.Height = orderGridSizeInfo.infoPanelHeight - 5; goodsNameText.Text = item.goodsList[i].name; goodsNameText.TextAlignment = TextAlignment.Left; goodsNameText.Foreground = new SolidColorBrush(Color.FromArgb(255,51,51,51)); goodsNameText.SetValue(RelativePanel.AlignLeftWithPanelProperty,true); goodsNameText.SetValue(RelativePanel.AlignBottomWithPanelProperty,true); goodsNameText.Margin = new Thickness(orderGridSizeInfo.margin,0,0,orderGridSizeInfo.margin); goodsItemPanel.Children.Add(goodsNameText); //goods number TextBlock numberText = new TextBlock(); numberText.Height = orderGridSizeInfo.infoPanelHeight - 5; numberText.Width = 25; numberText.Name = "number"; numberText.TextAlignment = TextAlignment.Right; numberText.Foreground = new SolidColorBrush(Color.FromArgb(255,51,51,51)); numberText.Text = "x" + Convert.ToString(item.goodsList[i].count); numberText.SetValue(RelativePanel.AlignRightWithPanelProperty,true); numberText.SetValue(RelativePanel.AlignBottomWithPanelProperty,true); numberText.Margin = new Thickness(0,0, orderGridSizeInfo.margin, orderGridSizeInfo.margin); goodsItemPanel.Children.Add(numberText); //goods price TextBlock singlePriceText = new TextBlock(); singlePriceText.Height = orderGridSizeInfo.infoPanelHeight; singlePriceText.Width = 30; singlePriceText.Name = "singlePriceText"; singlePriceText.TextAlignment = TextAlignment.Left; singlePriceText.FontSize = 20; singlePriceText.Foreground = new SolidColorBrush(Color.FromArgb(255, 253, 40, 3)); singlePriceText.Text = item.goodsList[i].price; singlePriceText.SetValue(RelativePanel.AlignBottomWithPanelProperty,true); singlePriceText.SetValue(RelativePanel.LeftOfProperty, "number"); singlePriceText.Margin = new Thickness(0,0,0, orderGridSizeInfo.margin); goodsItemPanel.Children.Add(singlePriceText); TextBlock priceSymbol = new TextBlock(); priceSymbol.Height = orderGridSizeInfo.infoPanelHeight - 5; priceSymbol.Width = 20; priceSymbol.TextAlignment = TextAlignment.Right; priceSymbol.FontSize = 16; priceSymbol.Foreground = new SolidColorBrush(Color.FromArgb(255, 253, 40, 3)); priceSymbol.Text = "¥"; priceSymbol.SetValue(RelativePanel.AlignBottomWithPanelProperty,true); priceSymbol.SetValue(RelativePanel.LeftOfProperty, "singlePriceText"); priceSymbol.Margin = new Thickness(0, 0, 0, orderGridSizeInfo.margin); goodsItemPanel.Children.Add(priceSymbol); //pictrue name TextBlock picNameText = new TextBlock(); picNameText.Name = "picNameText"; picNameText.Height = orderGridSizeInfo.infoPanelHeight; picNameText.Width = orderGridSizeInfo.goodsPicWidth; picNameText.Text = item.goodsList[i].imageName; picNameText.TextAlignment = TextAlignment.Left; picNameText.Foreground = new SolidColorBrush(Color.FromArgb(255, 51, 51, 51)); picNameText.FontSize = 18; picNameText.SetValue(RelativePanel.AlignLeftWithPanelProperty,true); picNameText.SetValue(RelativePanel.AboveProperty, "singlePriceText"); picNameText.Margin = new Thickness(orderGridSizeInfo.margin, 0, 0, orderGridSizeInfo.margin); goodsItemPanel.Children.Add(picNameText); //goods picture Grid picGrid = new Grid(); RowDefinition row = new RowDefinition(); row.Height = new GridLength(orderGridSizeInfo.goodsPicHeight); ColumnDefinition col = new ColumnDefinition(); col.Width = new GridLength(orderGridSizeInfo.goodsPicWidth); picGrid.RowDefinitions.Add(row); picGrid.ColumnDefinitions.Add(col); Border border = new Border(); border.BorderBrush = new SolidColorBrush(Colors.White); border.BorderThickness = new Thickness(1); border.CornerRadius = new CornerRadius(3, 3, 3, 3); border.Background = item.goodsList[i].brush; picGrid.Children.Add(border); picGrid.SetValue(RelativePanel.AlignLeftWithPanelProperty, true); picGrid.SetValue(RelativePanel.AlignRightWithPanelProperty,true); picGrid.SetValue(RelativePanel.AlignTopWithPanelProperty,true); picGrid.SetValue(RelativePanel.AboveProperty, "picNameText"); picGrid.Margin = new Thickness(orderGridSizeInfo.margin, orderGridSizeInfo.margin, orderGridSizeInfo.margin, orderGridSizeInfo.margin); goodsItemPanel.Children.Add(picGrid); goodsGridPanelWidth += (orderGridSizeInfo.goodsPicWidth + 3*orderGridSizeInfo.margin); goodsGridPanel.Children.Add(goodsItemPanel); } SlidePanel slidePanel = new SlidePanel(infoPanel.Width); goodsGridPanel.Width = goodsGridPanelWidth; slidePanel.Add(goodsGridPanel, orderGridSizeInfo.goodsPicWidth + orderGridSizeInfo.margin); Grid.SetColumn(slidePanel, 0); Grid.SetRow(slidePanel, 1); oneOrderGrid.Children.Add(slidePanel); #endregion Grid.SetColumn(oneOrderGrid, 0); Grid.SetRow(oneOrderGrid, nRow); orderGrid.Children.Add(oneOrderGrid); nRow++; } }