protected override NWidget CreateExampleContent() { // Create a dock panel with red border m_DockPanel = new NDockPanel(); m_DockPanel.Border = NBorder.CreateFilledBorder(NColor.Red); m_DockPanel.BorderThickness = new NMargins(1); // Create and dock several widgets NWidget widget = CreateDockedWidget(ENDockArea.Left); widget.PreferredSize = new NSize(100, 100); m_DockPanel.Add(widget); widget = CreateDockedWidget(ENDockArea.Top); widget.PreferredSize = new NSize(100, 100); m_DockPanel.Add(widget); widget = CreateDockedWidget(ENDockArea.Right); widget.PreferredSize = new NSize(100, 100); m_DockPanel.Add(widget); widget = CreateDockedWidget(ENDockArea.Bottom); widget.PreferredSize = new NSize(100, 100); m_DockPanel.Add(widget); widget = CreateDockedWidget(ENDockArea.Center); widget.PreferredSize = new NSize(300, 300); m_DockPanel.Add(widget); return(m_DockPanel); }
private NWidget CreateCustomRequestWidget() { NGroupBox groupBox = new NGroupBox("Custom Request"); NDockPanel dock = new NDockPanel(); groupBox.Content = dock; NLabel label = new NLabel("URI:"); label.VerticalPlacement = ENVerticalPlacement.Center; NDockLayout.SetDockArea(label, ENDockArea.Left); dock.Add(label); m_CustomURITextBox = new NTextBox(); m_CustomURITextBox.Text = "http://www.nevron.com/gallery/FullGalleries/chart/pie/images/3D-pie-cut-edge-ring.png"; m_CustomURITextBox.Padding = new NMargins(0, 3, 0, 3); NDockLayout.SetDockArea(m_CustomURITextBox, ENDockArea.Center); dock.Add(m_CustomURITextBox); NButton submitButton = new NButton("Submit"); NDockLayout.SetDockArea(submitButton, ENDockArea.Right); submitButton.Click += new Function <NEventArgs>(OnSumbitCustomRequestClick); dock.Add(submitButton); return(groupBox); }
/// <summary> /// Default constructor. /// </summary> public NExamplesHomePage() { // Apply a Windows 8 theme Document.InheritStyleSheets = false; NUITheme theme = new NWindows8Theme(); Document.StyleSheets.ApplyTheme(theme); m_ExamplesMap = null; // Add some custom styles Document.StyleSheets.Add(CreateCustomStyleSheet(theme)); // Load the metafile images Stream emfStream = NResources.Instance.GetResourceStream("RBIN_HomePageEmfs_zip"); m_EmfDecompressor = new NEmfDecompressor(); NCompression.DecompressZip(emfStream, m_EmfDecompressor); // Create the main dock panel m_MainPanel = new NDockPanel(); m_MainPanel.HorizontalSpacing = GroupHorizontalSpacing; m_MainPanel.VerticalSpacing = GroupVerticalSpacing; m_MainPanel.Padding = new NMargins(GroupHorizontalSpacing, GroupVerticalSpacing); m_MainPanel.HorizontalPlacement = ENHorizontalPlacement.Center; m_MainPanel.VerticalPlacement = ENVerticalPlacement.Center; // Create the contacts and the header labels m_MainPanel.Add(CreateSearchAndContacts(), ENDockArea.Top); m_HeaderLabel = CreateHeader(); m_MainPanel.Add(m_HeaderLabel, ENDockArea.Top); // Create the page panel m_PagePanel = new NSingleVisiblePanel(); m_PagePanel.Add(CreateWelcomePanel()); m_MainPanel.Add(m_PagePanel, ENDockArea.Center); // Place the main panel in a scroll content NScrollContent scrollContent = new NScrollContent(m_MainPanel); scrollContent.WindowBackgroundFill = new NColorFill(BackgroundColor); scrollContent.NoScrollHAlign = ENNoScrollHAlign.Center; scrollContent.NoScrollVAlign = ENNoScrollVAlign.Center; scrollContent.HorizontalPlacement = ENHorizontalPlacement.Fit; scrollContent.VerticalPlacement = ENVerticalPlacement.Fit; scrollContent.Border = null; scrollContent.BorderThickness = NMargins.Zero; // Place the scroll content in a document box surface to prevent theme style inheritance NDocumentBoxSurface surface = new NDocumentBoxSurface(scrollContent); surface.TextFill = new NColorFill(TextColor); Document.Content = surface; }
protected override NWidget CreateExampleControls() { NStackPanel stack = new NStackPanel(); stack.VerticalSpacing = 10; // Create the predefined tests list box NListBox testListBox = new NListBox(); testListBox.Items.Add(CreateTestListBoxItem(new NRichTextBorders())); testListBox.Items.Add(CreateTestListBoxItem(new NRichTextLists())); testListBox.Items.Add(CreateTestListBoxItem(new NRichTextTables())); testListBox.Items.Add(CreateTestListBoxItem(new NRichTextTextStyles())); testListBox.Items.Add(CreateTestListBoxItem(new NRichTextElementPositioning())); testListBox.Selection.Selected += OnTestListBoxItemSelected; // Add the list box in a group box stack.Add(new NGroupBox("Predefined text documents", testListBox)); // Create the Load from file group box NDockPanel dockPanel = new NDockPanel(); dockPanel.HorizontalSpacing = 3; dockPanel.VerticalSpacing = 3; NButton loadButton = new NButton("Load"); loadButton.Click += OnLoadButtonClick; NDockLayout.SetDockArea(loadButton, ENDockArea.Bottom); dockPanel.Add(loadButton); m_FileNameTextBox = new NTextBox(); m_FileNameTextBox.VerticalPlacement = ENVerticalPlacement.Center; NDockLayout.SetDockArea(m_FileNameTextBox, ENDockArea.Center); dockPanel.Add(m_FileNameTextBox); NButton browseButton = new NButton("..."); browseButton.Click += OnBrowseButtonClick; NDockLayout.SetDockArea(browseButton, ENDockArea.Right); dockPanel.Add(browseButton); stack.Add(new NGroupBox("Load from file", dockPanel)); m_ElapsedTimeLabel = new NLabel(); stack.Add(m_ElapsedTimeLabel); // Select the initial test testListBox.Selection.SingleSelect(testListBox.Items[0]); return(stack); }
private NListBoxItem CreateDetailedListBoxItem(int index) { NDockPanel dock = new NDockPanel(); dock.HorizontalSpacing = 3; dock.Padding = new NMargins(0, 2, 0, 2); // Add the image string imageName = ImageNames[index % ImageNames.Length]; NImage icon = new NImage(new NEmbeddedResourceRef(NResources.Instance, "RIMG__24x24_" + imageName + "_png")); NImageBox imageBox = new NImageBox(icon); imageBox.HorizontalPlacement = ENHorizontalPlacement.Center; imageBox.VerticalPlacement = ENVerticalPlacement.Center; NDockLayout.SetDockArea(imageBox, ENDockArea.Left); dock.Add(imageBox); // Add the title NLabel titleLabel = new NLabel("Item " + index.ToString()); titleLabel.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, 10, ENFontStyle.Bold); NDockLayout.SetDockArea(titleLabel, ENDockArea.Top); dock.AddChild(titleLabel); // Add the description NLabel descriptionLabel = new NLabel("This is item " + index.ToString() + "'s description."); NDockLayout.SetDockArea(descriptionLabel, ENDockArea.Center); dock.AddChild(descriptionLabel); return(new NListBoxItem(dock)); }
void OnDockInsideChartPlotCheckBoxCheckedChanged(NValueChangeEventArgs arg) { NLegend legend = m_ChartView.Surface.Legends[0]; NCartesianChart chart = (NCartesianChart)m_ChartView.Surface.Charts[0]; legend.ParentNode.RemoveChild(legend); if (((NCheckBox)arg.TargetNode).Checked) { // dock the legend inside the chart NDockPanel dockPanel = new NDockPanel(); chart.Content = dockPanel; dockPanel.Add(legend); } else { // dock the legend inside the chart NDockPanel content = m_ChartView.Surface.Content as NDockPanel; content.Add(legend); } }
protected override NWidget CreateExampleContent() { // create a view and get its grid m_View = new NTableGridView(); NTableGrid grid = m_View.Grid; // bind the grid to the data source grid.DataSource = NDummyDataSource.CreatePersonsDataSource(); // configure the master grid grid.AllowEdit = false; // assign some icons to the columns for (int i = 0; i < grid.Columns.Count; i++) { NDataColumn dataColumn = grid.Columns[i] as NDataColumn; if (dataColumn == null) { continue; } NImage image = null; switch (dataColumn.FieldName) { case "Name": image = NResources.Image__16x16_Contacts_png; break; case "Gender": image = NResources.Image__16x16_Gender_png; break; case "Birthday": image = NResources.Image__16x16_Birthday_png; break; case "Country": image = NResources.Image__16x16_Globe_png; break; case "Phone": image = NResources.Image__16x16_Phone_png; break; case "Email": image = NResources.Image__16x16_Mail_png; break; default: continue; } // NOTE: The CreateHeaderContentDelegate is invoked whenever the Title changes or the UpdateHeaderContent() is called. // you can use this event to create custom column header content dataColumn.CreateHeaderContentDelegate = delegate(NColumn theColumn) { NPairBox pairBox = new NPairBox(image, theColumn.Title, ENPairBoxRelation.Box1BeforeBox2); pairBox.Spacing = 2; return(pairBox); }; dataColumn.UpdateHeaderContent(); } // create the custom detail that creates a widget displaying information about the row. // NOTE: The widget is created by the OnCustomDetailCreateWidget event handler. NMasterDetails masterDetails = grid.MasterDetails; NCustomDetail customDetail = new NCustomDetail(); masterDetails.Details.Add(customDetail); customDetail.CreateWidgetDelegate = delegate(NCustomDetailCreateWidgetArgs arg) { // get information about the data source row string name = (string)arg.DataSource.GetValue(arg.RowIndex, "Name"); ENGender gender = (ENGender)arg.DataSource.GetValue(arg.RowIndex, "Gender"); DateTime birthday = (DateTime)arg.DataSource.GetValue(arg.RowIndex, "Birthday"); ENCountry country = (ENCountry)arg.DataSource.GetValue(arg.RowIndex, "Country"); string phone = (string)arg.DataSource.GetValue(arg.RowIndex, "Phone"); string email = (string)arg.DataSource.GetValue(arg.RowIndex, "Email"); // display the information as a widget NPairBox namePair = new NPairBox("Name:", name); NPairBox genderPair = new NPairBox("Gender:", gender.ToString()); NPairBox birthdayPair = new NPairBox("Birthday:", birthday.ToString()); NPairBox countryPair = new NPairBox("Country:", country.ToString()); NPairBox phonePair = new NPairBox("Phone:", phone.ToString()); NPairBox emailPair = new NPairBox("Email:", email.ToString()); NImageBox image = new NImageBox(); switch (gender) { case ENGender.Male: image.Image = Nevron.Nov.Examples.NResources.Image__256x256_MaleIcon_jpg; break; case ENGender.Female: image.Image = Nevron.Nov.Examples.NResources.Image__256x256_FemaleIcon_jpg; break; default: break; } NStackPanel infoStack = new NStackPanel(); infoStack.VerticalSpacing = 2.0d; infoStack.Add(namePair); infoStack.Add(genderPair); infoStack.Add(birthdayPair); infoStack.Add(countryPair); infoStack.Add(phonePair); infoStack.Add(emailPair); NDockPanel dock = new NDockPanel(); dock.Add(image, ENDockArea.Left); dock.Add(infoStack, ENDockArea.Center); // assign the widget to the event arguments. return(dock); }; return(m_View); }