Telerik Forums
UI for WinForms Forum
1 answer
335 views
Hi,

I've noticed that you can check whether the selected font in the richtextbox is bold or italic, but not whether it is both bold and italic. Checking for bold or italic can be done likeso:

Dim style As StyleDefinition = SelectedEditor.CurrentEditingStyle
      Dim fontWeight As TextStyle = DirectCast(style.GetPropertyValue(Span.FontStyleProperty), TextStyle)
 
      btnFontBold.Checked = fontWeight = TextStyle.Bold
      If fontWeight = TextStyle.Bold Then
          btnFontBold.Checked = True
      ElseIf fontWeight = TextStyle.Italic Then
          btnFontItalic.Checked = True
      End If

However, I cannot seem to find a way to check for both bold and italic text, as the only members of TextStyle are Bold, Italic, and Regular. Is there a way to do this?
Plamen
Telerik team
 answered on 21 Nov 2012
1 answer
237 views
Hi,

I have several grids on RadForm. I want to resize grids and columns for the next time.
How I can do it.

Thank you for advance
Stefan
Telerik team
 answered on 21 Nov 2012
5 answers
226 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
533 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
174 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
292 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
243 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
100 views

deleted  wrong forum

Dave
Top achievements
Rank 1
 asked on 20 Nov 2012
2 answers
246 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
205 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
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)
Form
Chart (obsolete as of Q1 2013)
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
PdfViewer and PdfViewerNavigator
CommandBar
ListControl
Carousel
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
VirtualGrid
Toolstrip (obsolete as of Q3 2010)
Label
AutoCompleteBox
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
SplitContainer
Documentation
Map
DesktopAlert
CheckedDropDownList
ProgressBar
MessageBox
TrackBar
Rotator
SpinEditor
CheckedListBox
StatusStrip
Wizard
CollapsiblePanel
LayoutControl
ShapedForm
SyntaxEditor
TextBoxControl
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
WaitingBar
GroupBox
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
NavigationView
BindingNavigator
RibbonForm
Styling
Barcode
PopupEditor
TaskBoard
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Overlay
Security
LocalizationProvider
Dictionary
TreeMap
StepProgressBar
SplashScreen
Flyout
Separator
SparkLine
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
SpeechToTextButton
SmartPasteButton
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?