Telerik Forums
UI for WPF Forum
9 answers
1.1K+ views

Hello. I have a special classes: tbTechObject and tbTech. tbTechObject contains tbTech. When I use "full test search" it doesn`t work for column with tbTechObject items (telerik:GridViewComboBoxColumn  "ТСИ"). "full test search" work only for string columns. What have I do to "full test search" searches in column with my custom type elements? Thanks.

[global::System.ComponentModel.TypeConverter(typeof(tbTechObjectConverter))]
    public class tbTechObject : IEquatable<tbTechObject>, INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        private void FirePropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
        public int idTechObject { get; set; }
        public ObservableCollection<tbTech> nameTech { get; set; }//Items source for combobox column in radgridview. This class describe bellow
        private tbTech nTech;
        public tbTech NTech
        {
            get { return nTech; }
            set
            {
                if (this.nTech != value)
                {
                    this.nTech = value;
                    FirePropertyChanged("NTech");
                }
            }
        }
        public string serialNum { get; set; }
        public string inventNum { get; set; }
       
        public void save()
        {
            //save to db
        }
        bool IEquatable<tbTechObject>.Equals(tbTechObject other)
        {
            if (other == null)
            {
                return false;
            }
            return StringComparer.Ordinal.Equals(this.NTech.name, other.NTech.name);
        }
        public override bool Equals(object obj)
        {
            return ((IEquatable<tbTechObject>)this).Equals(obj as tbTechObject);
        }
        public override int GetHashCode()
        {
            if (this.NTech == null)
                this.NTech = this.nameTech[0];
            return this.NTech.name.GetHashCode() ^ this.idTechObject.GetHashCode();
        }
        public override string ToString()
        {
            return this.NTech.name;
        }
    }

    public class tbTechObjectConverter : System.ComponentModel.TypeConverter
    {
        public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, Type sourceType)
        {
            if (sourceType == typeof(string))
            {
                return true;
            }
            return base.CanConvertFrom(context, sourceType);
        }
        public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
        {
            var stringValue = value as string;
            if (stringValue != null)
            {
                return new tbTechObject {  idTechObject = -1 };
            }
            return base.ConvertFrom(context, culture, value);
        }
        public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, Type destinationType)
        {
            if (destinationType == typeof(string))
            {
                return true;
            }
            return base.CanConvertTo(context, destinationType);
        }
        public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(string))
            {
                return ((tbTechObject)value).ToString();
            }
            return base.ConvertTo(context, culture, value, destinationType);
        }
    }

 

/////////////////////////////////

[global::System.ComponentModel.TypeConverter(typeof(tbTechConverter))]
    public class tbTech : IEquatable<tbTech>, INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        private void FirePropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
       
        public int idNameTech { get; set; }
        public string name { get; set; }
       
        public bool save()
        {
            //save to db

        }   
       
        bool IEquatable<tbTech>.Equals(tbTech other)
        {
            if (other == null)
            {
                return false;
            }
            return StringComparer.Ordinal.Equals(this.name, other.name);
        }
        public override bool Equals(object obj)
        {
            return ((IEquatable<tbTech>)this).Equals(obj as tbTech);
        }
        public override int GetHashCode()
        {
            return this.name.GetHashCode() ^ this.idNameTech.GetHashCode();
        }
        public override string ToString()
        {
            return this.name;
        }
    }
    public class tbTechConverter : System.ComponentModel.TypeConverter
    {
        public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, Type sourceType)
        {
            if (sourceType == typeof(string))
            {
                return true;
            }
            return base.CanConvertFrom(context, sourceType);
        }
        public override object ConvertFrom(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
        {
            var stringValue = value as string;
            if (stringValue != null)
            {
                return new tbTech { name = stringValue, idNameTech = -1 };
            }
            return base.ConvertFrom(context, culture, value);
        }
        public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext context, Type destinationType)
        {
            if (destinationType == typeof(string))
            {
                return true;
            }
            return base.CanConvertTo(context, destinationType);
        }
        public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(string))
            {
                return ((tbTech)value).ToString();
            }
            return base.ConvertTo(context, culture, value, destinationType);
        }
    }

//////////////////XAML

<telerik:RadGridView x:Name="mainDG" Margin="259,0,5,5" AutoGenerateColumns="False" CanUserDeleteRows="False" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" MouseDoubleClick="mDClikMainDG" MouseRightButtonDown="mouseRBtnDownMainDG" ScrollMode="Deferred" AutomationProperties.IsRowHeader="True">
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" EditTriggers="CellClick" AutoSelectOnEdit="True">
                                <telerik:GridViewCheckBoxColumn.Header>
                                    <CheckBox  HorizontalAlignment="Center" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
                                    </CheckBox>
                                </telerik:GridViewCheckBoxColumn.Header>
                            </telerik:GridViewCheckBoxColumn>
                            <telerik:GridViewComboBoxColumn Header="ТСИ" Width="200" EditTriggers="CellClick" ItemsSourceBinding="{Binding nameTech}" DisplayMemberPath="name" DataMemberBinding="{Binding NTech, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"  SelectedValueMemberPath="{Binding NTech, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsComboBoxEditable="True" IsFilterable="True">
                               
                            </telerik:GridViewComboBoxColumn>

                            <telerik:GridViewDataColumn Header="Serial number" DataMemberBinding="{Binding serialNum}"/>
                            <telerik:GridViewDataColumn Header="Inventor number" DataMemberBinding="{Binding inventNum}"/>

 </telerik:RadGridView.Columns>
                    </telerik:RadGridView>

 

Stefan
Telerik team
 answered on 26 Feb 2018
1 answer
107 views

Hi,

We are currently migrating our current Silverlight / Telerik app to WPF and we have noticed a difference in how often the database is queried when scrolling using the deferred scrolling approach.

In the Silverlight implementation the database seems to only be queried when we let go of the mouse button and it does its skip / take then thus only a single DB hit.

In the WPF version using the same approach yields multiple DB hits whilst dragging the mouse down the scrollbar.

s this intentional / is there an option we have missed to get back to the same way the Silverlight implementation was working as it is impacting the performance of our app and the scrolling at this point.

Many thanks in advance

Lee

Vladimir Stoyanov
Telerik team
 answered on 26 Feb 2018
15 answers
938 views
Hello,

It's me again =)
I have a question about NullValue property:
Here is my numericUpDown control code:
As you see i want RadNumericUpDown to show nothing in it's textbox when it's binding value is null. But when the the userControl with this numericUpDown is loaded i see the value $0.00 in it's textbox instead of "empty" string.

<telerik:RadNumericUpDown Name="numericVMDNQRS"
            NullValue="" Value="{Binding Path=Tier.VMDNQRS,ValidatesOnDataErrors=True,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"
            IsEditable="True" AutoReverse="False" Minimum="0"          
            SmallChange="0.1"
            LargeChange="1" V
            alueFormat="Percentage"
            DataContext="{Binding}"/>


When i delete everything from textbox and it loses focus everything works well: no value appears in textbox.
I tried to check Value property of RadNumericUpDown on Initialized and Loaded event - it's not null but 0.0.
I also tried to inherit from RadNumericUpDown and override FormatDisplay mehtod to check the value that it get from argument, but it's also 0.0.
So the question is how to show nothing in RadNumericUpDown textbox when it has just loaded and it's binding value is null?
Dilyan Traykov
Telerik team
 answered on 26 Feb 2018
10 answers
164 views

Hi,

On my fields list I setting a custom display name.

When I dragged field from field list and I dropped to reportfilter/column label/ row label or values it keep the right name.

But when I drag field between reportfilter, column label, row label and values the dragged item show the Property name instead of the Display Name (see the attachment)

How can I fix it?

Thank you

Mattia
Top achievements
Rank 2
 answered on 26 Feb 2018
2 answers
439 views
If the user hides the searchpanel, the search values in the Background are still active. How can this i delete the values when the user closing the searchpanel.
Harald
Top achievements
Rank 2
 answered on 26 Feb 2018
3 answers
649 views

I want to cancel the delete event and not delete the current record. I just want to edit the current record and set the property "IsActive = false". 

1.private void MyDataForm_DeletingItem(object sender, System.ComponentModel.CancelEventArgs e)
2.        {
3.            Person currentPerson = this.MyDataForm.CurrentItem as Person;
4.            currentPerson.IsActive = true;
5.            e.Cancel = true;
6.        }

This code does not work. How can I implement the function?

 

 

Harald
Top achievements
Rank 2
 answered on 26 Feb 2018
2 answers
312 views

When binding to a dynamic object in the grid, we all know that the Dynamic column will be treated as an object and the cell templates will not be what is expected for some columns. Is there a property on the Column (I haven't found one digging in the source yet) to set the columns data type or do I need to use a Template Selector to achieve this per column that I don't want to be treated as a string?

 

Thanks,
Maurice

Maurice
Top achievements
Rank 1
 answered on 23 Feb 2018
133 answers
1.5K+ views

RadCalendar:

RadDiagram:

  • Create custom shapes in the RadDiagram with MVVM - The forum thread elaborates on how to create custom shapes in the RadDiagram following an MVVM approach.
  • Populate the RadDiagramToolbox with custom business data - In this forum thread you can find a sample solution and guidelines on how to populate the RadDiagramToolbox with custom business data and based on the data type drop different objects on the diagramming surface. The attached solution also demonstrates an approach for providing custom information in a SettingsPane tab.
RadGridView:
  • Unfocused state for the selected GridViewRow - With Q2 2012 we have introduced a new Unfocused state for the selected GridViewRow. It will be shown when the GridView is out of focus. If you want to revert to the previous behavior you can check this help article.
RadPivotGrid: RadRichTextBox:
  • Guidelines for Printing with RadDocument - As RadDocument is sometimes used independently of RadRichTextBox to layout content and export it, this article explains the basics of creating a document programmatically.
Dinko | Tech Support Engineer
Telerik team
 answered on 23 Feb 2018
7 answers
119 views
Dear Sir,

We want extend RadPanelBar and RadPanelBarItem to make them multilingual in accordance with our multilingual framework. But problem is that as soon as we extend these classes it do not render at all even if we do not write single line of code in the extended class.

Same problem is also with other controls like Tab Control.

Please suggest us how to resolve this issue.

Regards
Vinay
Dinko | Tech Support Engineer
Telerik team
 answered on 23 Feb 2018
1 answer
95 views

Bing's branding guidelines states, "Bing Maps data provider attribution information can be accessed through the Get Imagery Metadata method in Bing Maps REST Services."

https://www.microsoft.com/en-us/maps/mobile-brand-guidelines

I see there's an imagery metadata classes in RadMaps, but I don't see how to access or use them. Can you provide an example?

Petar Mladenov
Telerik team
 answered on 23 Feb 2018
Narrow your results
Selected tags
Tags
+? 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?