Edit RadGridView

2 posts, 0 answers
  1. תמרה
    תמרה avatar
    1 posts
    Member since:
    Jun 2015

    Posted 21 Jun 2015 Link to this post

    i have a radGrid that bind to string with delimiter such as : string: key=value;key=value;....
    i bind this string to the grid by converter from string to dictionary and back.

    this is the radgrid:

    <telerik:RadGridView x:Name="radGrid" Grid.Column="0" Grid.Row="5" Grid.ColumnSpan="2"
                Margin="10,20,10,10"   NewRowPosition="Top"
                ItemsSource="{Binding CurrentParameter.Values,  Mode=TwoWay,
       Converter={StaticResource StringToDictConverter}}"
                CanUserInsertRows="True" IsReadOnly="False"
                CanUserDeleteRows ="True"
                    <telerik:GridViewDataColumn Header="Key"  DataMemberBinding="{Binding Key}" Width="*">
                  <telerik:GridViewDataColumn Header="Value"    DataMemberBinding="{Binding Value}" Width="*">                                       </telerik:GridViewDataColumn>

    this is the converter:

    public object Convert(
                  object value,
                  Type targetType,
                  object parameter,
                  CultureInfo culture
              Dictionary<string, string> dict = new Dictionary<string, string>();
              if (value != null)
                  string[] arr = value.ToString().Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                  foreach (string s in arr)
                      string[] sArr = s.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries);
                      dict.Add(sArr[0], sArr[1]);
              return dict;
          public object ConvertBack
                  object value,
                  Type targetType,
                  object parameter,
                  CultureInfo culture
              if (!(value is Dictionary<string, string>))
                  return null;
              string sBack = "";
              foreach (KeyValuePair<string, string> item in (Dictionary<string, string>)value)
                  sBack += item.Key + "=" + item.Value + ";";
              return sBack;

    the currentParameter Implements INotifyPropertyChanged.

    so i want to edit the values in radGrid but it's not possible because the  keyValuePair from converter is read only!

    what i can do?

  2. Stefan
    Stefan avatar
    1073 posts

    Posted 24 Jun 2015 Link to this post


    I implemented the code you pasted in a sample project and such error is not raised. Can you please take a look at it and let me know if I am missing something?

    Stefan X1
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top