Simulate TreeList load on demand

This commit is contained in:
Desislava Yordanova 2021-12-06 15:18:31 +02:00
Родитель 494a7e553e
Коммит b2c33acf2f
29 изменённых файлов: 2196 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,18 @@
## Environment
<table>
<tr>
<td>Product Version</td>
<td>2021.3.1123</td>
</tr>
<tr>
<td>Product</td>
<td>RadTreeView for WinForms</td>
</tr>
</table>
## Description
This solution aims to show you a sample approach how to use RadTreeView with custom nodes simulating a load on demand self-reference grid.
Step by step guide: https://docs.telerik.com/devtools/winforms/knowledge-base/simulate-treelist-load-on-demand

Просмотреть файл

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31911.196
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SelfRefLoadOnDemandGrid", "SelfRefLoadOnDemandGrid\SelfRefLoadOnDemandGrid.csproj", "{1E6BBB18-AE5F-45E6-9E55-8A1E8E5DD94C}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "SelfRefLoadOnDemandGridVB", "SelfRefLoadOnDemandGridVB\SelfRefLoadOnDemandGridVB.vbproj", "{3419466F-873F-4276-BDF3-7CDF97DF37D4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1E6BBB18-AE5F-45E6-9E55-8A1E8E5DD94C}.Debug|x86.ActiveCfg = Debug|x86
{1E6BBB18-AE5F-45E6-9E55-8A1E8E5DD94C}.Debug|x86.Build.0 = Debug|x86
{1E6BBB18-AE5F-45E6-9E55-8A1E8E5DD94C}.Release|x86.ActiveCfg = Release|x86
{1E6BBB18-AE5F-45E6-9E55-8A1E8E5DD94C}.Release|x86.Build.0 = Release|x86
{3419466F-873F-4276-BDF3-7CDF97DF37D4}.Debug|x86.ActiveCfg = Debug|x86
{3419466F-873F-4276-BDF3-7CDF97DF37D4}.Debug|x86.Build.0 = Debug|x86
{3419466F-873F-4276-BDF3-7CDF97DF37D4}.Release|x86.ActiveCfg = Release|x86
{3419466F-873F-4276-BDF3-7CDF97DF37D4}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4A23AAA8-6D09-4C5C-8B42-C827BE7325DB}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7"/></startup>
<appSettings>
<add key="TelerikWinFormsThemeName" value="Fluent"/>
</appSettings>
</configuration>

Просмотреть файл

@ -0,0 +1,20 @@
using System;
using System.Linq;
using System.Windows.Forms;
namespace SelfRefLoadOnDemandGrid
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new RadForm1());
}
}
}

Просмотреть файл

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SelfRefLoadOnDemandGrid")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SelfRefLoadOnDemandGrid")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7286ebe5-418c-4920-83ab-a392d48b6b7d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Просмотреть файл

@ -0,0 +1,73 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SelfRefLoadOnDemandGrid.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SelfRefLoadOnDemandGrid.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap pen {
get {
object obj = ResourceManager.GetObject("pen", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

Просмотреть файл

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="pen" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\pen.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Просмотреть файл

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SelfRefLoadOnDemandGrid.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Просмотреть файл

@ -0,0 +1,69 @@
namespace SelfRefLoadOnDemandGrid
{
partial class RadForm1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.radTreeView1 = new Telerik.WinControls.UI.RadTreeView();
((System.ComponentModel.ISupportInitialize)(this.radTreeView1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
this.SuspendLayout();
//
// radTreeView1
//
this.radTreeView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.radTreeView1.ItemHeight = 28;
this.radTreeView1.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
this.radTreeView1.LineStyle = Telerik.WinControls.UI.TreeLineStyle.Solid;
this.radTreeView1.Location = new System.Drawing.Point(0, 0);
this.radTreeView1.Name = "radTreeView1";
this.radTreeView1.Size = new System.Drawing.Size(393, 270);
this.radTreeView1.TabIndex = 0;
//
// RadForm1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(393, 270);
this.Controls.Add(this.radTreeView1);
this.Name = "RadForm1";
//
//
//
this.RootElement.ApplyShapeToControl = true;
this.Text = "RadForm1";
((System.ComponentModel.ISupportInitialize)(this.radTreeView1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this)).EndInit();
this.ResumeLayout(false);
}
#endregion
private Telerik.WinControls.UI.RadTreeView radTreeView1;
}
}

Просмотреть файл

@ -0,0 +1,406 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls;
using Telerik.WinControls.UI;
namespace SelfRefLoadOnDemandGrid
{
public partial class RadForm1 : Telerik.WinControls.UI.RadForm
{
DataTable externalSource = new DataTable();
public static int columnWidth = 220;
public static Color borderColor = Color.FromArgb(21, 215, 255);
public RadForm1()
{
InitializeComponent();
externalSource.Columns.Add("Id", typeof(string));
externalSource.Columns.Add("ParentId", typeof(string));
externalSource.Columns.Add("Title", typeof(string));
externalSource.Columns.Add("Date", typeof(DateTime));
externalSource.Columns.Add("DeliveryType", typeof(DeliveryType));
string id = string.Empty;
string childId = string.Empty;
for (int i = 0; i < 100; i++)
{
id = Guid.NewGuid().ToString();
externalSource.Rows.Add(id, null, "Root " + i, DateTime.Now.AddDays(i).AddHours(i),
i % 2 == 0 ? DeliveryType.PickUp : DeliveryType.Delivery);
for (int j = 0; j < 20; j++)
{
childId = Guid.NewGuid().ToString();
externalSource.Rows.Add(childId, id, "Child " + i + "." + j, DateTime.Now.AddDays(i).AddHours(i),
j % 2 == 0 ? DeliveryType.PickUp : DeliveryType.Delivery);
for (int k = 0; k < 5; k++)
{
externalSource.Rows.Add(Guid.NewGuid().ToString(), childId, "Child " + i + "." + j + "." + k, DateTime.Now.AddDays(i).AddHours(i),
j % 2 == 0 ? DeliveryType.PickUp : DeliveryType.Delivery);
}
}
}
this.radTreeView1.TreeViewElement.CreateNodeElement += TreeViewElement_CreateNodeElement;
this.radTreeView1.LazyMode = true;
this.radTreeView1.NodesNeeded += radTreeView1_NodesNeeded;
this.radTreeView1.ItemHeight = 50;
this.radTreeView1.AllowEdit = true;
this.radTreeView1.TreeViewElement.EditMode = TreeNodeEditMode.Text;
this.radTreeView1.EditorRequired += radTreeView1_EditorRequired;
this.radTreeView1.EditorInitialized += RadTreeView1_EditorInitialized;
}
private void RadTreeView1_EditorInitialized(object sender, TreeNodeEditorInitializedEventArgs e)
{
}
private void radTreeView1_EditorRequired(object sender, TreeNodeEditorRequiredEventArgs e)
{
e.Editor = new CustomRadTreeViewEditor();
}
void TreeViewElement_CreateNodeElement(object sender, Telerik.WinControls.UI.CreateTreeNodeElementEventArgs e)
{
e.NodeElement = new CustomTreeNodeElement();
}
private void radTreeView1_NodesNeeded(object sender, NodesNeededEventArgs e)
{
LoadNodesForParent(e.Parent, e.Nodes);
}
private void LoadNodesForParent(RadTreeNode parentNode, IList<RadTreeNode> nodes)
{
if (parentNode == null)
{
foreach (DataRow row in externalSource.Rows)
{
if (row["ParentId"] == null || row["ParentId"].Equals(System.DBNull.Value))
{
nodes.Add(new RadTreeNode() { Text = row["Title"].ToString(), Tag = row, Value = row["Id"] });
}
}
}
else
{
foreach (DataRow row in externalSource.Rows)
{
if (row["ParentId"].ToString() == parentNode.Value.ToString())
{
nodes.Add(new RadTreeNode() { Text = row["Title"].ToString(), Tag = row, Value = row["Id"] });
}
}
}
}
public enum DeliveryType
{
PickUp,
Delivery
}
public class CustomTreeNodeElement : TreeNodeElement
{
protected override TreeNodeContentElement CreateContentElement()
{
return new CustomContentElement();
}
protected override Type ThemeEffectiveType
{
get
{
return typeof(TreeNodeElement);
}
}
}
class CustomContentElement : TreeNodeContentElement
{
StackLayoutElement mainContainer;
StackLayoutElement headersContainer;
StackLayoutElement nodeContentContainer;
protected override Type ThemeEffectiveType
{
get
{
return typeof(TreeNodeContentElement);
}
}
protected override void CreateChildElements()
{
base.CreateChildElements();
mainContainer = new StackLayoutElement();
mainContainer.Orientation = Orientation.Vertical;
headersContainer = new StackLayoutElement();
// headersContainer.Orientation = Orientation.Horizontal;
nodeContentContainer = new StackLayoutElement();
mainContainer.Children.Add(headersContainer);
mainContainer.Children.Add(nodeContentContainer);
this.Children.Add(mainContainer);
}
public override void Synchronize()
{
base.Synchronize();
this.DrawText = false;
DataRow row = this.NodeElement.Data.Tag as DataRow;
if (row != null)
{
mainContainer.MinSize = new Size(columnWidth * row.Table.Columns.Count, this.NodeElement.Data.TreeView.ItemHeight);
if (headersContainer.Children.Count == 0)
{
foreach (DataColumn col in row.Table.Columns)
{
//generate columns
LightVisualElement columnHeader = new LightVisualElement();
columnHeader.Margin = new Padding(0, 0, -1, 0);
columnHeader.MinSize = columnHeader.MaxSize = new System.Drawing.Size(columnWidth, 20);
columnHeader.StretchHorizontally = true;
columnHeader.Text = col.ColumnName;
headersContainer.Children.Add(columnHeader);
StyleBorder(columnHeader);
//generate data cells
LightVisualElement contentCell = new LightVisualElement();
contentCell.Margin = new System.Windows.Forms.Padding(0, -1, -1, 0);
StyleBorder(contentCell);
contentCell.MinSize = new System.Drawing.Size(columnWidth, 24);
nodeContentContainer.Children.Add(contentCell);
}
}
for (int i = 0; i < nodeContentContainer.Children.Count; i++)
{
LightVisualElement contentCell = nodeContentContainer.Children[i] as LightVisualElement;
string text = row[i].ToString();
DateTime dt = DateTime.MinValue;
if (i == nodeContentContainer.Children.Count - 2)
{
if (DateTime.TryParse(text, out dt))
{
text = dt.ToString("dd/MM/yyyy");
}
}
else if (i == nodeContentContainer.Children.Count - 1)
{
text = Enum.GetName(typeof(DeliveryType), row[i]);
}
contentCell.Text = text;
}
}
}
}
private static void StyleBorder(LightVisualElement element)
{
element.DrawBorder = true;
element.BorderGradientStyle = GradientStyles.Solid;
element.BorderColor = borderColor;
}
public class CustomRadTreeViewEditor : BaseInputEditor
{
protected override RadElement CreateEditorElement()
{
return new CustomRadTreeViewEditorElement();
}
public new CustomRadTreeViewEditorElement EditorElement
{
get
{
return base.EditorElement as CustomRadTreeViewEditorElement;
}
}
public override Type DataType => typeof(string);
public override object Value
{
get
{
TreeNodeContentElement nodeElement = this.EditorElement.Parent as TreeNodeContentElement;
DataRow row = nodeElement.NodeElement.Data.Tag as DataRow;
return row;
}
set { }
}
public override void BeginEdit()
{
base.BeginEdit();
TreeNodeContentElement nodeElement = this.EditorElement.Parent as TreeNodeContentElement;
nodeElement.NodeElement.Data.Image = Properties.Resources.pen;
}
public override bool EndEdit()
{
TreeNodeContentElement nodeElement = this.EditorElement.Parent as TreeNodeContentElement;
nodeElement.NodeElement.Data.Image = null;
return base.EndEdit();
}
public class CustomRadTreeViewEditorElement : BaseTextBoxEditorElement
{
StackLayoutElement mainContainer;
StackLayoutElement headersContainer;
StackLayoutElement nodeContentContainer;
RadDropDownListElement dropDownList;
RadDateTimeEditorElement dateEditor;
LightVisualElement idEditor;
LightVisualElement parentIdEditor;
RadTextBoxControlElement titleEditor;
protected override void CreateChildElements()
{
mainContainer = new StackLayoutElement();
mainContainer.Orientation = Orientation.Vertical;
mainContainer.StretchHorizontally = true;
mainContainer.StretchVertically = true;
headersContainer = new StackLayoutElement();
headersContainer.Orientation = Orientation.Horizontal;
nodeContentContainer = new StackLayoutElement();
nodeContentContainer.StretchHorizontally = true;
mainContainer.Children.Add(headersContainer);
mainContainer.Children.Add(nodeContentContainer);
this.Children.Add(mainContainer);
dropDownList = new RadDropDownListElement();
}
protected override void OnLoaded()
{
base.OnLoaded();
if (this.Children.Contains(this.TextBoxItem))
{
this.Children.Remove(this.TextBoxItem);
}
TreeNodeContentElement nodeElement = this.Parent as TreeNodeContentElement;
if (nodeElement.NodeElement.Data != null)
{
DataRow row = nodeElement.NodeElement.Data.Tag as DataRow;
mainContainer.MinSize = new Size(columnWidth * row.Table.Columns.Count,
nodeElement.NodeElement.Data.TreeView.ItemHeight);
mainContainer.DrawFill = true;
mainContainer.GradientStyle = GradientStyles.Solid;
mainContainer.BackColor = nodeElement.NodeElement.BackColor;
mainContainer.Margin = new Padding(-2, -4, 0, 0);
if (headersContainer.Children.Count == 0)
{
foreach (DataColumn col in row.Table.Columns)
{
//generate columns
LightVisualElement columnHeader = new LightVisualElement();
columnHeader.MinSize = new System.Drawing.Size(columnWidth, 20);
columnHeader.StretchHorizontally = true;
columnHeader.Text = col.ColumnName;
headersContainer.Children.Add(columnHeader);
StyleBorder(columnHeader);
//generate data cells
if (col.ColumnName == "DeliveryType")
{
this.dropDownList = new RadDropDownListElement();
this.dropDownList.DropDownStyle = RadDropDownStyle.DropDownList;
this.dropDownList.MinSize = new System.Drawing.Size(columnWidth, 0);
nodeContentContainer.Children.Add(this.dropDownList);
this.dropDownList.DataSource = Enum.GetValues(typeof(DeliveryType));
this.dropDownList.SelectedValueChanged += DropDownList_SelectedValueChanged;
}
else if (col.ColumnName == "Date")
{
this.dateEditor = new RadDateTimeEditorElement();
this.dateEditor.Format = DateTimePickerFormat.Custom;
this.dateEditor.CustomFormat = "dd/MM/yyyy";
this.dateEditor.MinSize = new System.Drawing.Size(columnWidth, 20);
nodeContentContainer.Children.Add(this.dateEditor);
this.dateEditor.ValueChanged += DateEditor_ValueChanged;
}
else if (col.ColumnName == "Id")
{
this.idEditor = new LightVisualElement();
this.idEditor.StretchVertically = true;
this.idEditor.MinSize = new System.Drawing.Size(columnWidth, 24);
StyleBorder(this.idEditor);
nodeContentContainer.Children.Add(this.idEditor);
}
else if (col.ColumnName == "ParentId")
{
this.parentIdEditor = new LightVisualElement();
this.parentIdEditor.MinSize = new System.Drawing.Size(columnWidth, 20);
this.parentIdEditor.Margin = new System.Windows.Forms.Padding(0, -1, 0, 0);
StyleBorder(this.parentIdEditor);
nodeContentContainer.Children.Add(this.parentIdEditor);
}
else if (col.ColumnName == "Title")
{
this.titleEditor = new RadTextBoxControlElement();
this.titleEditor.Margin = new System.Windows.Forms.Padding(0, -1, 0, 0);
StyleBorder(this.titleEditor);
this.titleEditor.MinSize = new System.Drawing.Size(columnWidth, 20);
nodeContentContainer.Children.Add(this.titleEditor);
this.titleEditor.TextChanged += TitleEditor_TextChanged;
}
}
}
this.dropDownList.SelectedValueChanged -= DropDownList_SelectedValueChanged;
this.dateEditor.ValueChanged -= DateEditor_ValueChanged;
this.titleEditor.TextChanged -= TitleEditor_TextChanged;
this.idEditor.Text = row["Id"].ToString();
this.parentIdEditor.Text = row["ParentId"].ToString();
this.titleEditor.Text = row["Title"].ToString();
this.dateEditor.Value = (DateTime)row["Date"];
this.dropDownList.SelectedValue = row["DeliveryType"];
this.titleEditor.TextChanged += TitleEditor_TextChanged;
this.dateEditor.ValueChanged += DateEditor_ValueChanged;
this.dropDownList.SelectedValueChanged += DropDownList_SelectedValueChanged;
}
}
private void DropDownList_SelectedValueChanged(object sender, Telerik.WinControls.UI.Data.ValueChangedEventArgs e)
{
TreeNodeContentElement nodeElement = this.Parent as TreeNodeContentElement;
DataRow row = nodeElement.NodeElement.Data.Tag as DataRow;
row["DeliveryType"] = this.dropDownList.SelectedValue;
}
private void DateEditor_ValueChanged(object sender, EventArgs e)
{
TreeNodeContentElement nodeElement = this.Parent as TreeNodeContentElement;
DataRow row = nodeElement.NodeElement.Data.Tag as DataRow;
row["Date"] = this.dateEditor.Value;
}
private void TitleEditor_TextChanged(object sender, EventArgs e)
{
TreeNodeContentElement nodeElement = this.Parent as TreeNodeContentElement;
DataRow row = nodeElement.NodeElement.Data.Tag as DataRow;
row["Title"] = this.titleEditor.Text;
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 531 B

Просмотреть файл

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{1E6BBB18-AE5F-45E6-9E55-8A1E8E5DD94C}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SelfRefLoadOnDemandGrid</RootNamespace>
<AssemblyName>SelfRefLoadOnDemandGrid</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Telerik.WinControls, Version=2021.3.1123.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Users\dyordano\Desktop\DLL\Telerik_UI_For_WinForms_2021_3_1123_Dev_dlls\Bin40\Telerik.WinControls.dll</HintPath>
</Reference>
<Reference Include="Telerik.WinControls.UI, Version=2021.3.1123.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Users\dyordano\Desktop\DLL\Telerik_UI_For_WinForms_2021_3_1123_Dev_dlls\Bin40\Telerik.WinControls.UI.dll</HintPath>
</Reference>
<Reference Include="TelerikCommon, Version=2021.3.1123.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Users\dyordano\Desktop\DLL\Telerik_UI_For_WinForms_2021_3_1123_Dev_dlls\Bin40\TelerikCommon.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="RadForm1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="RadForm1.Designer.cs">
<DependentUpon>RadForm1.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="RadForm1.resx">
<DependentUpon>RadForm1.cs</DependentUpon>
</EmbeddedResource>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\pen.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties ShouldAddDPIScalingManifest="True" />
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv1="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true/PM</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of all Windows versions that this application is designed to work with.
Windows will automatically select the most compatible environment.-->
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
</application>
</compatibility>
</asmv1:assembly>

Просмотреть файл

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7"/></startup>
<appSettings>
<add key="TelerikWinFormsThemeName" value="Fluent"/>
</appSettings>
</configuration>

Просмотреть файл

@ -0,0 +1,38 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
' or if you encounter build errors in this file, go to the Project Designer
' (go to Project Properties or double-click the My Project node in
' Solution Explorer), and make changes on the Application tab.
'
Partial Friend Class MyApplication
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Sub New()
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
Me.IsSingleInstance = false
Me.EnableVisualStyles = true
Me.SaveMySettingsOnExit = true
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
End Sub
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.SelfRefLoadOnDemandGridVB.RadForm1
End Sub
End Class
End Namespace

Просмотреть файл

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>true</MySubMain>
<MainForm>RadForm1</MainForm>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<ApplicationType>0</ApplicationType>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>

Просмотреть файл

@ -0,0 +1,35 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("SelfRefLoadOnDemandGridVB")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("SelfRefLoadOnDemandGridVB")>
<Assembly: AssemblyCopyright("Copyright © 2021")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("c534d398-7723-4ab1-8d3d-adcc31701f0e")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

Просмотреть файл

@ -0,0 +1,73 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Imports System
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("SelfRefLoadOnDemandGridVB.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set
resourceCulture = value
End Set
End Property
'''<summary>
''' Looks up a localized resource of type System.Drawing.Bitmap.
'''</summary>
Friend ReadOnly Property pen() As System.Drawing.Bitmap
Get
Dim obj As Object = ResourceManager.GetObject("pen", resourceCulture)
Return CType(obj,System.Drawing.Bitmap)
End Get
End Property
End Module
End Namespace

Просмотреть файл

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="pen" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\pen.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Просмотреть файл

@ -0,0 +1,73 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.SelfRefLoadOnDemandGridVB.My.MySettings
Get
Return Global.SelfRefLoadOnDemandGridVB.My.MySettings.Default
End Get
End Property
End Module
End Namespace

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Просмотреть файл

@ -0,0 +1,60 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class RadForm1
Inherits Telerik.WinControls.UI.RadForm
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.RadTreeView1 = New Telerik.WinControls.UI.RadTreeView()
CType(Me.RadTreeView1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'RadTreeView1
'
Me.RadTreeView1.Dock = System.Windows.Forms.DockStyle.Fill
Me.RadTreeView1.ItemHeight = 28
Me.RadTreeView1.LineColor = System.Drawing.Color.FromArgb(CType(CType(204, Byte), Integer), CType(CType(204, Byte), Integer), CType(CType(204, Byte), Integer))
Me.RadTreeView1.LineStyle = Telerik.WinControls.UI.TreeLineStyle.Solid
Me.RadTreeView1.Location = New System.Drawing.Point(0, 0)
Me.RadTreeView1.Name = "RadTreeView1"
Me.RadTreeView1.Size = New System.Drawing.Size(748, 367)
Me.RadTreeView1.TabIndex = 0
'
'RadForm1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(748, 367)
Me.Controls.Add(Me.RadTreeView1)
Me.Name = "RadForm1"
'
'
'
Me.RootElement.ApplyShapeToControl = True
Me.Text = "RadForm1"
CType(Me.RadTreeView1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents RadTreeView1 As Telerik.WinControls.UI.RadTreeView
End Class

Просмотреть файл

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

Просмотреть файл

@ -0,0 +1,372 @@
Imports Telerik.WinControls
Imports Telerik.WinControls.UI
Imports System.Windows.Forms
Public Class RadForm1
Private externalSource As DataTable = New DataTable()
Public Shared columnWidth As Integer = 220
Public Shared borderColor As Color = Color.FromArgb(21, 215, 255)
Public Sub New()
InitializeComponent()
externalSource.Columns.Add("Id", GetType(String))
externalSource.Columns.Add("ParentId", GetType(String))
externalSource.Columns.Add("Title", GetType(String))
externalSource.Columns.Add("Date", GetType(DateTime))
externalSource.Columns.Add("DeliveryType", GetType(DeliveryType))
Dim id As String = String.Empty
Dim childId As String = String.Empty
For i As Integer = 0 To 100 - 1
id = Guid.NewGuid().ToString()
externalSource.Rows.Add(id, Nothing, "Root " & i, DateTime.Now.AddDays(i).AddHours(i), If(i Mod 2 = 0, DeliveryType.PickUp, DeliveryType.Delivery))
For j As Integer = 0 To 20 - 1
childId = Guid.NewGuid().ToString()
externalSource.Rows.Add(childId, id, "Child " & i & "." & j, DateTime.Now.AddDays(i).AddHours(i), If(j Mod 2 = 0, DeliveryType.PickUp, DeliveryType.Delivery))
For k As Integer = 0 To 5 - 1
externalSource.Rows.Add(Guid.NewGuid().ToString(), childId, "Child " & i & "." & j & "." & k, DateTime.Now.AddDays(i).AddHours(i), If(j Mod 2 = 0, DeliveryType.PickUp, DeliveryType.Delivery))
Next
Next
Next
AddHandler Me.RadTreeView1.TreeViewElement.CreateNodeElement, AddressOf TreeViewElement_CreateNodeElement
Me.RadTreeView1.LazyMode = True
AddHandler Me.RadTreeView1.NodesNeeded, AddressOf radTreeView1_NodesNeeded
Me.RadTreeView1.ItemHeight = 50
Me.RadTreeView1.AllowEdit = True
Me.RadTreeView1.TreeViewElement.EditMode = TreeNodeEditMode.Text
AddHandler Me.RadTreeView1.EditorRequired, AddressOf radTreeView1_EditorRequired
AddHandler Me.RadTreeView1.EditorInitialized, AddressOf RadTreeView1_EditorInitialized
End Sub
Private Sub RadTreeView1_EditorInitialized(ByVal sender As Object, ByVal e As TreeNodeEditorInitializedEventArgs)
End Sub
Private Sub radTreeView1_EditorRequired(ByVal sender As Object, ByVal e As TreeNodeEditorRequiredEventArgs)
e.Editor = New CustomRadTreeViewEditor()
End Sub
Private Sub TreeViewElement_CreateNodeElement(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.CreateTreeNodeElementEventArgs)
e.NodeElement = New CustomTreeNodeElement()
End Sub
Private Sub radTreeView1_NodesNeeded(ByVal sender As Object, ByVal e As NodesNeededEventArgs)
LoadNodesForParent(e.Parent, e.Nodes)
End Sub
Private Sub LoadNodesForParent(ByVal parentNode As RadTreeNode, ByVal nodes As IList(Of RadTreeNode))
If parentNode Is Nothing Then
For Each row As DataRow In externalSource.Rows
If row("ParentId") Is Nothing OrElse row("ParentId").Equals(System.DBNull.Value) Then
nodes.Add(New RadTreeNode() With {
.Text = row("Title").ToString(),
.Tag = row,
.Value = row("Id")
})
End If
Next
Else
For Each row As DataRow In externalSource.Rows
If row("ParentId").ToString() = parentNode.Value.ToString() Then
nodes.Add(New RadTreeNode() With {
.Text = row("Title").ToString(),
.Tag = row,
.Value = row("Id")
})
End If
Next
End If
End Sub
Public Enum DeliveryType
PickUp
Delivery
End Enum
Public Class CustomTreeNodeElement
Inherits TreeNodeElement
Protected Overrides Function CreateContentElement() As TreeNodeContentElement
Return New CustomContentElement()
End Function
Protected Overrides ReadOnly Property ThemeEffectiveType As Type
Get
Return GetType(TreeNodeElement)
End Get
End Property
End Class
Class CustomContentElement
Inherits TreeNodeContentElement
Private mainContainer As StackLayoutElement
Private headersContainer As StackLayoutElement
Private nodeContentContainer As StackLayoutElement
Protected Overrides ReadOnly Property ThemeEffectiveType As Type
Get
Return GetType(TreeNodeContentElement)
End Get
End Property
Protected Overrides Sub CreateChildElements()
MyBase.CreateChildElements()
mainContainer = New StackLayoutElement()
mainContainer.Orientation = Orientation.Vertical
headersContainer = New StackLayoutElement()
nodeContentContainer = New StackLayoutElement()
mainContainer.Children.Add(headersContainer)
mainContainer.Children.Add(nodeContentContainer)
Me.Children.Add(mainContainer)
End Sub
Public Overrides Sub Synchronize()
MyBase.Synchronize()
Me.DrawText = False
Dim row As DataRow = TryCast(Me.NodeElement.Data.Tag, DataRow)
If row IsNot Nothing Then
mainContainer.MinSize = New Size(columnWidth * row.Table.Columns.Count, Me.NodeElement.Data.TreeView.ItemHeight)
If headersContainer.Children.Count = 0 Then
For Each col As DataColumn In row.Table.Columns
Dim columnHeader As LightVisualElement = New LightVisualElement()
columnHeader.Margin = New Padding(0, 0, -1, 0)
columnHeader.MinSize = New System.Drawing.Size(columnWidth, 20)
columnHeader.StretchHorizontally = True
columnHeader.Text = col.ColumnName
headersContainer.Children.Add(columnHeader)
StyleBorder(columnHeader)
Dim contentCell As LightVisualElement = New LightVisualElement()
contentCell.Margin = New System.Windows.Forms.Padding(0, -1, -1, 0)
StyleBorder(contentCell)
contentCell.MinSize = New System.Drawing.Size(columnWidth, 24)
nodeContentContainer.Children.Add(contentCell)
Next
End If
For i As Integer = 0 To nodeContentContainer.Children.Count - 1
Dim contentCell As LightVisualElement = TryCast(nodeContentContainer.Children(i), LightVisualElement)
Dim text As String = row(i).ToString()
Dim dt As DateTime = DateTime.MinValue
If i = nodeContentContainer.Children.Count - 2 Then
If DateTime.TryParse(text, dt) Then
text = dt.ToString("dd/MM/yyyy")
End If
ElseIf i = nodeContentContainer.Children.Count - 1 Then
text = [Enum].GetName(GetType(DeliveryType), row(i))
End If
contentCell.Text = text
Next
End If
End Sub
Private Class CSharpImpl
<Obsolete("Please refactor calling code to use normal Visual Basic assignment")>
Shared Function __Assign(Of T)(ByRef target As T, value As T) As T
target = value
Return value
End Function
End Class
End Class
Private Shared Sub StyleBorder(ByVal element As LightVisualElement)
element.DrawBorder = True
element.BorderGradientStyle = GradientStyles.Solid
element.BorderColor = borderColor
End Sub
Public Class CustomRadTreeViewEditor
Inherits BaseInputEditor
Protected Overrides Function CreateEditorElement() As RadElement
Return New CustomRadTreeViewEditorElement()
End Function
Public Overloads ReadOnly Property EditorElement As CustomRadTreeViewEditorElement
Get
Return TryCast(MyBase.EditorElement, CustomRadTreeViewEditorElement)
End Get
End Property
Public Overrides ReadOnly Property DataType As Type
Get
Return GetType(String)
End Get
End Property
Public Overrides Property Value As Object
Get
Dim nodeElement As TreeNodeContentElement = TryCast(Me.EditorElement.Parent, TreeNodeContentElement)
Dim row As DataRow = TryCast(nodeElement.NodeElement.Data.Tag, DataRow)
Return row
End Get
Set(ByVal value As Object)
End Set
End Property
Public Overrides Sub BeginEdit()
MyBase.BeginEdit()
Dim nodeElement As TreeNodeContentElement = TryCast(Me.EditorElement.Parent, TreeNodeContentElement)
nodeElement.NodeElement.Data.Image = My.Resources.pen
End Sub
Public Overrides Function EndEdit() As Boolean
Dim nodeElement As TreeNodeContentElement = TryCast(Me.EditorElement.Parent, TreeNodeContentElement)
nodeElement.NodeElement.Data.Image = Nothing
Return MyBase.EndEdit()
End Function
Public Class CustomRadTreeViewEditorElement
Inherits BaseTextBoxEditorElement
Private mainContainer As StackLayoutElement
Private headersContainer As StackLayoutElement
Private nodeContentContainer As StackLayoutElement
Private dropDownList As RadDropDownListElement
Private dateEditor As RadDateTimeEditorElement
Private idEditor As LightVisualElement
Private parentIdEditor As LightVisualElement
Private titleEditor As RadTextBoxControlElement
Protected Overrides Sub CreateChildElements()
mainContainer = New StackLayoutElement()
mainContainer.Orientation = Orientation.Vertical
mainContainer.StretchHorizontally = True
mainContainer.StretchVertically = True
headersContainer = New StackLayoutElement()
headersContainer.Orientation = Orientation.Horizontal
nodeContentContainer = New StackLayoutElement()
nodeContentContainer.StretchHorizontally = True
mainContainer.Children.Add(headersContainer)
mainContainer.Children.Add(nodeContentContainer)
Me.Children.Add(mainContainer)
dropDownList = New RadDropDownListElement()
End Sub
Protected Overrides Sub OnLoaded()
MyBase.OnLoaded()
If Me.Children.Contains(Me.TextBoxItem) Then
Me.Children.Remove(Me.TextBoxItem)
End If
Dim nodeElement As TreeNodeContentElement = TryCast(Me.Parent, TreeNodeContentElement)
If nodeElement.NodeElement.Data IsNot Nothing Then
Dim row As DataRow = TryCast(nodeElement.NodeElement.Data.Tag, DataRow)
mainContainer.MinSize = New Size(columnWidth * row.Table.Columns.Count, nodeElement.NodeElement.Data.TreeView.ItemHeight)
mainContainer.DrawFill = True
mainContainer.GradientStyle = GradientStyles.Solid
mainContainer.BackColor = nodeElement.NodeElement.BackColor
mainContainer.Margin = New Padding(-2, -4, 0, 0)
If headersContainer.Children.Count = 0 Then
For Each col As DataColumn In row.Table.Columns
Dim columnHeader As LightVisualElement = New LightVisualElement()
columnHeader.MinSize = New System.Drawing.Size(columnWidth, 20)
columnHeader.StretchHorizontally = True
columnHeader.Text = col.ColumnName
headersContainer.Children.Add(columnHeader)
StyleBorder(columnHeader)
If col.ColumnName = "DeliveryType" Then
Me.dropDownList = New RadDropDownListElement()
Me.dropDownList.DropDownStyle = RadDropDownStyle.DropDownList
Me.dropDownList.MinSize = New System.Drawing.Size(columnWidth, 0)
nodeContentContainer.Children.Add(Me.dropDownList)
Me.dropDownList.DataSource = [Enum].GetValues(GetType(DeliveryType))
AddHandler Me.dropDownList.SelectedValueChanged, AddressOf DropDownList_SelectedValueChanged
ElseIf col.ColumnName = "Date" Then
Me.dateEditor = New RadDateTimeEditorElement()
Me.dateEditor.Format = DateTimePickerFormat.Custom
Me.dateEditor.CustomFormat = "dd/MM/yyyy"
Me.dateEditor.MinSize = New System.Drawing.Size(columnWidth, 20)
nodeContentContainer.Children.Add(Me.dateEditor)
AddHandler Me.dateEditor.ValueChanged, AddressOf DateEditor_ValueChanged
ElseIf col.ColumnName = "Id" Then
Me.idEditor = New LightVisualElement()
Me.idEditor.StretchVertically = True
Me.idEditor.MinSize = New System.Drawing.Size(columnWidth, 24)
StyleBorder(Me.idEditor)
nodeContentContainer.Children.Add(Me.idEditor)
ElseIf col.ColumnName = "ParentId" Then
Me.parentIdEditor = New LightVisualElement()
Me.parentIdEditor.MinSize = New System.Drawing.Size(columnWidth, 20)
Me.parentIdEditor.Margin = New System.Windows.Forms.Padding(0, -1, 0, 0)
StyleBorder(Me.parentIdEditor)
nodeContentContainer.Children.Add(Me.parentIdEditor)
ElseIf col.ColumnName = "Title" Then
Me.titleEditor = New RadTextBoxControlElement()
Me.titleEditor.Margin = New System.Windows.Forms.Padding(0, -1, 0, 0)
StyleBorder(Me.titleEditor)
Me.titleEditor.MinSize = New System.Drawing.Size(columnWidth, 20)
nodeContentContainer.Children.Add(Me.titleEditor)
AddHandler Me.titleEditor.TextChanged, AddressOf TitleEditor_TextChanged
End If
Next
End If
RemoveHandler Me.dropDownList.SelectedValueChanged, AddressOf DropDownList_SelectedValueChanged
RemoveHandler Me.dateEditor.ValueChanged, AddressOf DateEditor_ValueChanged
RemoveHandler Me.titleEditor.TextChanged, AddressOf TitleEditor_TextChanged
Me.idEditor.Text = row("Id").ToString()
Me.parentIdEditor.Text = row("ParentId").ToString()
Me.titleEditor.Text = row("Title").ToString()
Me.dateEditor.Value = CType(row("Date"), DateTime)
Me.dropDownList.SelectedValue = row("DeliveryType")
AddHandler Me.titleEditor.TextChanged, AddressOf TitleEditor_TextChanged
AddHandler Me.dateEditor.ValueChanged, AddressOf DateEditor_ValueChanged
AddHandler Me.dropDownList.SelectedValueChanged, AddressOf DropDownList_SelectedValueChanged
End If
End Sub
Private Sub DropDownList_SelectedValueChanged(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.Data.ValueChangedEventArgs)
Dim nodeElement As TreeNodeContentElement = TryCast(Me.Parent, TreeNodeContentElement)
Dim row As DataRow = TryCast(nodeElement.NodeElement.Data.Tag, DataRow)
row("DeliveryType") = Me.dropDownList.SelectedValue
End Sub
Private Sub DateEditor_ValueChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim nodeElement As TreeNodeContentElement = TryCast(Me.Parent, TreeNodeContentElement)
Dim row As DataRow = TryCast(nodeElement.NodeElement.Data.Tag, DataRow)
row("Date") = Me.dateEditor.Value
End Sub
Private Sub TitleEditor_TextChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim nodeElement As TreeNodeContentElement = TryCast(Me.Parent, TreeNodeContentElement)
Dim row As DataRow = TryCast(nodeElement.NodeElement.Data.Tag, DataRow)
row("Title") = Me.titleEditor.Text
End Sub
Private Class CSharpImpl
<Obsolete("Please refactor calling code to use normal Visual Basic assignment")>
Shared Function __Assign(Of T)(ByRef target As T, value As T) As T
target = value
Return value
End Function
End Class
End Class
Private Class CSharpImpl
<Obsolete("Please refactor calling code to use normal Visual Basic assignment")>
Shared Function __Assign(Of T)(ByRef target As T, value As T) As T
target = value
Return value
End Function
End Class
End Class
End Class

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 531 B

Просмотреть файл

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{3419466F-873F-4276-BDF3-7CDF97DF37D4}</ProjectGuid>
<OutputType>WinExe</OutputType>
<StartupObject>SelfRefLoadOnDemandGridVB.My.MyApplication</StartupObject>
<RootNamespace>SelfRefLoadOnDemandGridVB</RootNamespace>
<AssemblyName>SelfRefLoadOnDemandGridVB</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>WindowsForms</MyType>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>SelfRefLoadOnDemandGridVB.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>SelfRefLoadOnDemandGridVB.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Telerik.WinControls, Version=2021.3.1123.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
<HintPath>..\lib\RCWF\2021.3.1123.40\Telerik.WinControls.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Telerik.WinControls.UI, Version=2021.3.1123.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
<HintPath>..\lib\RCWF\2021.3.1123.40\Telerik.WinControls.UI.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="TelerikCommon, Version=2021.3.1123.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
<HintPath>..\lib\RCWF\2021.3.1123.40\TelerikCommon.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Drawing" />
<Import Include="System.Diagnostics" />
<Import Include="System.Windows.Forms" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="RadForm1.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="RadForm1.Designer.vb">
<DependentUpon>RadForm1.vb</DependentUpon>
<SubType>Form</SubType>
</Compile>
<EmbeddedResource Include="My Project\licenses.licx" />
<EmbeddedResource Include="RadForm1.resx">
<DependentUpon>RadForm1.vb</DependentUpon>
</EmbeddedResource>
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="app.manifest" />
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\pen.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties ShouldAddDPIScalingManifest="True" />
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv1="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true/PM</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of all Windows versions that this application is designed to work with.
Windows will automatically select the most compatible environment.-->
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
</application>
</compatibility>
</asmv1:assembly>