Telerik Forums
UI for WPF Forum
1 answer
240 views

Hi, i m ashrul

i have problem here, so i have radgridview like this, i have to set selected item on child, in my case last data in is the last selected item automatically from code behind without click.

but i can't handle that.

 

my code like this :

 int a = radTreeListView.Items.TotalItemCount;

 var selectedItem = this.radTreeListView.Items[a-1] as Data;

 

and Data is my property class.

so what i want is, if user add a new data in radgridview so its automatically selected from code behind.

 

thanks in advanced.

 

Vladimir Stoyanov
Telerik team
 answered on 13 Jun 2018
7 answers
460 views
I'm trying to use ItemsSourceBinding. The list is displayed but the selected item is not commited to binded property (see attached picture).
XAML:
<telerik:RadGridView Name="playersGrid"
                             ItemsSource="{Binding Players}"
                             AutoGenerateColumns="False">
 
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Number}"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Position}"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Country}" IsReadOnlyBinding="{Binding IsReadOnlyProperty}"/>
 
                <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding ClubID}"                                                                               
                                                SelectedValueMemberPath="ID"
                                                ItemsSourceBinding="{Binding AvailableClubs}"
                                                DisplayMemberPath="Name" />
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>

ViewModel:
/// <summary>
/// A football player.
/// </summary>
public class Player : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;
 
    private string name;
    private int number;
    private Position position;
    private string country;
 
 
    private bool isReadOnlyProperty;
    public bool IsReadOnlyProperty
    {
        get { return this.isReadOnlyProperty; }
        set
        {
            if (value != this.isReadOnlyProperty)
            {
                this.isReadOnlyProperty = value;
                this.OnPropertyChanged("IsReadOnlyProperty");
            }
        }
    }
    private int clubID;
    public int ClubID
    {
        get { return this.clubID; }
        set
        {
            if (value != this.clubID)
            {
                this.clubID = value;
                this.UpdateIsReadOnlyProperty(this.clubID);
                this.OnPropertyChanged("ClubID");
 
            }
        }
    }
 
 
    public string Name
    {
        get { return this.name; }
        set
        {
            if (value != this.name)
            {
                this.name = value;
                this.OnPropertyChanged("Name");
            }
        }
    }
 
    public int Number
    {
        get { return this.number; }
        set
        {
            if (value != this.number)
            {
                this.number = value;
                this.OnPropertyChanged("Number");
            }
        }
    }
 
    public Position Position
    {
        get { return this.position; }
        set
        {
            if (value != this.position)
            {
                this.position = value;
                this.OnPropertyChanged("Position");
            }
        }
    }
 
    public string Country
    {
        get { return this.country; }
        set
        {
            if (value != this.country)
            {
                this.country = value;
                this.OnPropertyChanged("Country");
            }
        }
    }
 
    public IEnumerable<Club> AvailableClubs
    {
        get
        {
            return from c in Club.GetClubs()
                   where c.ID == this.ClubID
                   select c;
        }
    }
 
    public Player()
    {
 
    }
 
    public Player(string name, int number, Position position, string country, int clubID, bool isReadOnlyProperty)
    {
        this.name = name;
        this.number = number;
        this.position = position;
        this.country = country;
        this.clubID = clubID;
        this.isReadOnlyProperty = isReadOnlyProperty;
    }
 
    protected virtual void OnPropertyChanged(PropertyChangedEventArgs args)
    {
        PropertyChangedEventHandler handler = this.PropertyChanged;
        if (handler != null)
        {
            handler(this, args);
        }
    }
 
    private void OnPropertyChanged(string propertyName)
    {
        this.OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
    }
 
    public override string ToString()
    {
        return this.Name;
    }
 
    public static ObservableCollection<Player> GetPlayers()
    {
        return new ObservableCollection<Player>(Club.GetClubs().SelectMany(c => c.Players));
    }
 
    private void UpdateIsReadOnlyProperty(int clubID)
    {
        if (clubID == 2 || clubID == 3)
        {
            this.IsReadOnlyProperty = true;
        }
        else
        {
            this.IsReadOnlyProperty = false;
        }
    }
}

This sample is based on SL sample attached by Maya here: http://www.telerik.com/community/forums/silverlight/gridview/binding-from-radgridview-to-radcombobox.aspx 
Dinko | Tech Support Engineer
Telerik team
 answered on 13 Jun 2018
1 answer
227 views

Hi,

I was wondering if there was a way to provide the format to display a formatted DateTime like we do with the DateTimeFormatString in other grids. I am looking to have the datatype of the field as DateTime to preserve the filtering. Any advice in this regard would be greatly appreciated.

 

Thanks,

Sri

Yoan
Telerik team
 answered on 12 Jun 2018
13 answers
2.0K+ views
Hey!

So. I'm having a RadGridView which looks something like this (simplified)

<Grid DataContext="{Binding}" Margin="5,5,5,5" MaxHeight="300" MinHeight="100">                                
                                <telerik:RadGridView x:Name="DeliverableTypesGridView" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"                                                                         
                                    ShowGroupPanel="False"
                                    SelectionMode="Single"
                                    AutoGenerateColumns="False"                                    
                                    CanUserReorderColumns="False"
                                    CanUserDeleteRows="False"
                                    CanUserInsertRows="True"                                    
                                    ShowInsertRow="True"
                                    ItemsSource="{Binding DeliverableTypes}">                                    
                                    <telerik:RadGridView.Columns>
                                        <telerik:GridViewSelectColumn />
                                        <telerik:GridViewDataColumn Header="Code" DataMemberBinding="{Binding Code, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"  />
                                        <telerik:GridViewDataColumn Header="DeliverableType" DataMemberBinding="{Binding Description}" IsReadOnly="True" />                                        
                                                                       
                                        <telerik:GridViewComboBoxColumn Header="Due Date Rule"
                                                                        DataMemberBinding="{Binding DueDateRule.Description, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                                        ItemsSource="{Binding ReferenceData.AllDueDateRules}"                                                                         
                                                                        DisplayMemberPath="Description"                                                                        
                                                                        />                                                                               
                                        <telerik:GridViewCheckBoxColumn Header="Active"  DataMemberBinding="{Binding Active}" />
                                        <telerik:GridViewDataColumn Header="Comments" DataMemberBinding="{Binding Comments}"/>
                                        <telerik:GridViewDataColumn Header="Created By" DataMemberBinding="{Binding CreatedBy}" IsReadOnly="True" />
                                        <telerik:GridViewDataColumn Header="Created On" DataFormatString="{}{0:M/d/yyyy}" IsVisible="True" DataMemberBinding="{Binding CreatedOn}" IsReadOnly="True"/>
                                        <telerik:GridViewDataColumn Header="Last Modified By" DataMemberBinding="{Binding LastModifiedBy}" IsReadOnly="True"/>
                                        <telerik:GridViewDataColumn Header="Last Modified On" DataFormatString="{}{0:M/d/yyyy}" IsVisible="True" DataMemberBinding="{Binding LastModifiedOn}" IsReadOnly="True"/>                                        
                                    </telerik:RadGridView.Columns>
                                </telerik:RadGridView>
                            </Grid>

Concentrate on the GridViewComboBoxColumn. I'm successfully binding my item source to the combo box on every row has.
But the thing is that when the Grid appears on the screen the GridViewComboBoxColumn  column shows no information.

As I'm using WPF MVVM pattern I'm having a public ObservableCollection<DeliverableTypeModel> DeliverableTypes property on a ManageDeliverableViewModel.cs whcih I use as DataConext. My DeliverableTypeModel.cs has a DeliverableDueDateRule Property as well.

My intention is to show the value that the DeliverableDueDateRule Property  has under this field in the grid ,
but I get a blank column instead.
The thing that is working is that when I click on a cell of the blank column I get a comboBox whith the items on the items source

Thanks!
Vladimir Stoyanov
Telerik team
 answered on 12 Jun 2018
1 answer
121 views

Hi there,

is there no german localization for the spreadsheet ribbon?

Best regards

 

Peshito
Telerik team
 answered on 12 Jun 2018
1 answer
163 views

Is there a way to serialize/deserialize a RadCartesianChart instance? I saw methods to export to an image, but that is not what I want.

I have an application that creates/shows instances of RadCartesianChart. I want to render the same chart in a separate application and let users interact with it. Are there any other approaches that can be recommended to handle this problem?

 

Kind Regards,

Albert

Martin Ivanov
Telerik team
 answered on 11 Jun 2018
1 answer
338 views

Hi, I am creating a project using the valiadtion as IDataErrorInfo, but I need to create a simple edit form that the RadMaskedTextInput components have the Value option filled with a value.

 

This is my example TextInput:

                <telerik:RadMaskedTextInput Value="{Binding Interessado, Mode=TwoWay, ValidatesOnDataErrors=True, NotifyOnValidationError=True, ValidatesOnExceptions=True}"
                                            x:Name="Interessado" 
                                            EmptyContent="Nome ou razão social"
                                            Culture="pt-BR"
                                            Mask=""
                                            InputBehavior="Insert"
                                            UpdateValueEvent="PropertyChanged" 
                                            HorizontalAlignment="Stretch"/>

 

And this is my validation class:

    public class Validations : IDataErrorInfo
    {
        public string Interessado { get; set; }

        #region IDataErrorInfo

        public string this[string columnName]
        {
            get
            {
                if ("Interessado" == columnName)
                {
                    if (String.IsNullOrEmpty(Interessado))
                    {
                        return "Campo Nome do Interessado é obrigatório!";
                    }
                }
   
                return "";
            }
        }

        public string Error
        {
            get { throw new NotImplementedException(); }
        }
    }

 

So, how can I set the Value with a text (because I am using the Value option for Binding)?

Dinko | Tech Support Engineer
Telerik team
 answered on 11 Jun 2018
5 answers
200 views

Is it possible to change the order of the items used in the filter?

 

Now they are being set by the order of the columns of the gridviewcolumns

Stefan
Telerik team
 answered on 11 Jun 2018
3 answers
181 views

Hi. 

I had Page with RadRichTextBox like word format.

It almost same with default telerik word project.

I want RadRichTextBox filled in Grid's RowDefinition(1), could resize.

Please see attched files. How can I fill it to row ?

sorry for so basically.

thanks.

Tanya
Telerik team
 answered on 08 Jun 2018
3 answers
128 views

Nothing happens if you try to change order of items in grid grouping panel by drag and drop. However it worked in version 2015.

Any idea? Is that bug? I could not find any solution on forum too.

Thanks for any hints!


Ivan Ivanov
Telerik team
 answered on 08 Jun 2018
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
InlineAIAssistant
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?