Telerik Forums
UI for WinForms Forum
5 answers
159 views
Hi, I'm starting developing with Telerik WinForms and WebForms controls. First of all, I'm changin' a System TreeView for a Telerik TreeView. I wasn't hard, but, in my last Tree, I had one property for sort a custom level of the tree. I'd make a class NodeComparer that implements IComparer. Now, in Telerik, I read that this property is called RadTreeNodeComparer, and needs a class that implements IComparer<RadTreeNode>.

So, the code is like this:
    UIPresentationTree.RadTreeNodeComparer = new NodeSorter();

Nothing happens, and the tree don't sort anything. What's wrong?

thanks.
Stefan
Telerik team
 answered on 21 Nov 2012
1 answer
335 views
I am binding objects to a hierarchy grid in code and when a change is made a child row the change is shown in the grid, however, the underlying data object is not updated.  I can manually apply the new value after edit to the object, but it seems like grid should be doing this for me.

public partial class Form1 : Form
    {
        private BindingList<Node> AllNodes = new BindingList<Node>();
 
        public Form1()
        {
            InitializeComponent();
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
            LoadData();
        }
 
        public void LoadData()
        {
            LoadAllNodes();
            grid.DataSource = AllNodes;
            LoadAllObjectColumns(grid.MasterTemplate);
            // Load child template
            GridViewTemplate template = new GridViewTemplate();
            LoadAllObjectColumns(template);
            grid.MasterTemplate.Templates.Add(template);
 
            GridViewRelation r = new GridViewRelation(grid.MasterTemplate, template);
            r.ChildColumnNames.Add("Children");
 
            grid.Relations.Add(r);
        }
 
        public void LoadAllNodes()
        {
            Node p1 = new Node("Parent 1", ItemStatus.None);
            Node n1 = new Node("Child 1", ItemStatus.None);
            Node n2 = new Node("Child 2", ItemStatus.None);
            p1.Children.Add(n1);
            p1.Children.Add(n2);
            AllNodes.Add(p1);
            Node p2 = new Node("Parent 2", ItemStatus.None);
            AllNodes.Add(p2);
        }
 
        public static void LoadAllObjectColumns(GridViewTemplate template)
        {
            template.Columns.Clear();
            template.EnableFiltering = true;
            template.AllowAddNewRow = false;
            template.AutoGenerateColumns = false;
 
            GridViewTextBoxColumn colName = new GridViewTextBoxColumn("Name");
            colName.HeaderText = "Name";
            colName.Name = "Name";
            template.Columns.Add(colName);
 
            GridViewComboBoxColumn colStatus = new GridViewComboBoxColumn("Status");
            colStatus.HeaderText = "Status";
            colStatus.Name = "Status";
            colStatus.DataSource = Enum.GetValues(typeof(ItemStatus)).Cast<ItemStatus>();
            template.Columns.Add(colStatus);
 
            template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
        }
 
        public enum ItemStatus { None, New, Test, Complete };
 
        public class Node : INotifyPropertyChanged
        {
            public event PropertyChangedEventHandler PropertyChanged;
            protected void NotifyPropertyChanged(String info)
            {
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs(info));
                }
            }
 
            private string name;
            private ItemStatus status;
            private BindingList<Node> children;
 
            public string Name
            {
                get
                {
                    return name;
                }
                set
                {
                    if (name != value)
                    {
                        name = value;
                        NotifyPropertyChanged("Name");
                    }
                }
            }
 
            public ItemStatus Status
            {
                get
                {
                    return status;
                }
                set
                {
                    if (status != value)
                    {
                        status = value;
                        NotifyPropertyChanged("Status");
                    }
                }
            }
 
            public BindingList<Node> Children
            {
                get
                {
                    return children;
                }
                set
                {
                    children = value;
                }
            }
 
            public Node(string name, ItemStatus status)
            {
                this.name = name;
                this.status = status;
                children = new BindingList<Node>();
            }
        }
    }


Julian Benkov
Telerik team
 answered on 21 Nov 2012
1 answer
105 views
i have 2 ddls and i want to populate the second one based on the value of the first one. so i went on to use a row filter to filter the data view to get the data i need on the second ddl but when the page loads i get the error operator & not defined for string "Select distinct Zones....." and data row view. i click ok on the dialog error box to close it and it goes on to open the form and the code actually works. so how do i get rid of the error

cmd.CommandText = "Select Distinct Zones.ZoneID,CustomerItems.CustomerID as CustomerID,Zones.Zone " & _
"From CustomerItems Inner Join Zones On Zones.ZoneID=CustomerItems.ZoneID " & _
"Inner Join StockItems On StockItems.StockID=CustomerItems.StockID Where CustomerItems.CustomerID='" & ddlCustomers.SelectedValue & "'"
da = New SqlDataAdapter(cmd)
da.Fill(ds, "Zones")

'Populate Zones
ddlZone.DisplayMember = "Zone"
ddlZone.ValueMember = "ZoneID"
ddlZone.DataSource = ds.Tables("Zones")


setup = False
If Not setup Then
Dim dv As DataView
dv = New DataView(ds.Tables("Zones"))
'dv.RowFilter = "CustomerID = '" & ddlCustomers.SelectedValue & "'"
dv.RowFilter = "[CustomerID] = " & ddlCustomers.SelectedValue
ddlZone.DataSource = dv
ddlZone.ValueMember = "ZoneID"
ddlZone.DisplayMember = "Zone"
setup = False
End If
Stefan
Telerik team
 answered on 21 Nov 2012
1 answer
230 views
HI,

is there any way that i can use Autocomplete with PropertyGridTextBoxEditor ?

Thanks ,
Ishara
Ivan Petrov
Telerik team
 answered on 20 Nov 2012
7 answers
165 views
Hello,

We currently have a field of our class that is the list of possible Texture that we can assign to a Sprite. It is a collection received by our Converter
class TextureConverter : ResourceConverter
    {
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            Type[] tType = new Type[] { typeof(Texture), typeof(TextureAtlas) };
            string[] tResource = ProjectManager.Singleton.CurrentProject.GetResourceNameListForType(tType, false);
            return new StandardValuesCollection(tResource);
        }
    }
And our class member goes like this:
[Category("Settings Sprite")]
        [DisplayName("Texture")]
        [Description("Current Texture")]
        [TypeConverter(typeof(TextureConverter))]
        public virtual string Texture
        {
            get
            {
                return mTextureCBValues;
            }
            set
            {
                if (mTextureCBValues != value)
                {
                    if (value == "")
                    {
                        ResetTexture();
                    }
                    else
                    {
                        Item tTex = ProjectManager.Singleton.CurrentProject.GetResourceByName(value, true, Name);
                        if (tTex is Texture)
                        {
                            mTextureCBValues = value;
                            SetTexture(tTex as Texture);
                        }
                        else if (tTex is TextureAtlas)
                        {
                            mTextureCBValues = value;
                            SetTextureAtlas(tTex as TextureAtlas);
                        }
                        else
                        {
                            SetStatus(Item.StatusState.ERROR, "Texture " + value + " is not found or invalid");
                            ResetTexture();
                        }
                    }
 
                    Refresh();
                    NotifyPropertyChanged();
                }
            }
        }

How is it possible to make that field so we can "search" (auto-suggestion) for the texture name we want?

Kaven
Ivan Petrov
Telerik team
 answered on 20 Nov 2012
0 answers
69 views

deleted  wrong forum

Dave
Top achievements
Rank 1
 asked on 20 Nov 2012
2 answers
180 views
Hi , I have to do a list of thumb images with on the left side a dropdown to select a print format
but whe I try to add a RadDropDownList
to this.Children in the CreateChildElements event I get this error "unknown method add(Telerik.WinControl.UI.RadDropDownList) of telerik.wincontrol.radElementCollection

here is the code
protected override void CreateChildElements()
         {
             base.CreateChildElements();
 
             this.stackLayout = new StackLayoutPanel();
             this.stackLayout.Orientation = Orientation.Horizontal;
 
             this.contentElement = new LightVisualElement();
               this.contentElement.StretchHorizontally = true;
             this.contentElement.MinSize = new Size(220, 2200);
             this.stackLayout.Children.Add(this.contentElement);
 
             imageElement = new clsBackDropItem(null,160,106);
             imageElement.ImageLayout = System.Windows.Forms.ImageLayout.Center;
             this.stackLayout.Children.Add(this.imageElement);
 
             this.buttonElement2 = new RadButtonElement();
             this.buttonElement2.Text = "Button2";
             this.stackLayout.Children.Add(this.buttonElement2);
 
             this.dd=new RadDropDownList();
             this.stackLayout.Children.Add(this.dd);
             this.Children.Add(this.stackLayout);

thanks in advance for any suggestion
ciao
Ivan Todorov
Telerik team
 answered on 20 Nov 2012
1 answer
153 views
Wondering if there is a simple way to do this...

I add an object to my entity context but I have not saved changes yet.  Therefore there is no ID or key associated to the entity.
I do however bind the grids datasource to the entities context.  The data appears in the grid in the appropriate file.

However, if I want to modify or delete a row whereas the entity hasn't been saved, I can't execute a LINQ query or something to get the record; again because it hasn't been saved yet.

Is there a way to get and assign the entity based upon the row selected?

dim detail as Invoice_Detail = gridview.selectedrow(0)....  Or something to that extent.

Thanks
Bob
Julian Benkov
Telerik team
 answered on 20 Nov 2012
2 answers
106 views
I have 2 lineseries charts, one under another.  The horizonal axes labels come from the same data set, however the vertical axes for both vary.

Since the labels for the vertical axes are different, the 0 points for each chart are not aligned.  I haven't been able to figure out how to get these to line up.  What am I missing?

I am trying to accomplish something like that is in the demo for ChartView -> Chart Types -> Stock Series \ Indicators except that I want the vertical axes on the right hand side.

Attached is a screen shot of the 2 graph unaligned.
Boryana
Telerik team
 answered on 20 Nov 2012
3 answers
239 views
When I retrieve a SortDescriptors.Expression from my RadGridView the column names are not escaped when they have a space in the name. The FilterDescriptors.Expression does this correctly (IMO) or at least returns what I expect.

For example, I have a RadGridView bound to a DataTable with the following columns: ID, Unit ID, Name
I have the grid sorted by the column 'Unit ID' and also filtered to include only records where 'Unit ID'=1 at run-time.
I then run the following commands:
string sort = this.myRadGridView.SortDescriptors.Expression;
Console.WriteLine(sort);
 
string filter = this.myRadGridView.FilterDescriptors.Expression;
Console.WriteLine(filter);

I get the following output:
Unit ID ASC
([Unit ID] = 1)

With the FilterDescriptors.Expression value I can insert that string directly  back into a SQL query with no issues. With the SortDescriptors.Expression I have to run an addional routine on the result before I can use it in a query.

I have a workaround I am using right now (simple string replace) but the inconsistant results were something I thought I should bring up here. Maybe the SortDescriptors could be changed to work more like the FilterDescriptors in the future? Anyway, this post is mainly an 'FYI' but if anyone has any comments or tips, they would be appreciated.
Julian Benkov
Telerik team
 answered on 20 Nov 2012
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
DropDownList
Buttons, RadioButton, CheckBox, etc
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Chart (obsolete as of Q1 2013)
Form
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
Diagram, DiagramRibbonBar, DiagramToolBox
GanttView
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
CheckedDropDownList
ProgressBar
TrackBar
MessageBox
Rotator
SpinEditor
StatusStrip
CheckedListBox
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
DataEntry
ScrollablePanel
ScrollBar
WaitingBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
PopupEditor
RibbonForm
Styling
TaskBoard
Barcode
Callout
ColorBox
PictureBox
FilterView
Accessibility
NavigationView
VirtualKeyboard
DataLayout
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
Licensing
BarcodeView
BreadCrumb
Security
LocalizationProvider
Dictionary
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
ToolbarForm
NotifyIcon
DateOnlyPicker
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?