This is a migrated thread and some comments may be shown as answers.

String Templates Don't Update With String Property Changes

4 Answers 48 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 15 Apr 2013, 08:34 PM
I'm not sure if this is a bug, or if I'm doing something wrong, but when I change a string property of my business object, the gridpropertyview string editor field doesn't reflect the new value, I have to force the control to update (ie. type in the search field) for the new value to be displayed.  The radcombobox seems to update automatically, as does the checkbox.  Is there a way to force the update with the textbox automatically?

4 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 16 Apr 2013, 06:32 AM
Hi Andrew,

Will it be possible to provide a bit more information about your exact scenario ? Do you update the property outside the property grid like:

private void RadButton_Click(object sender, RoutedEventArgs e)
        {
            var firstClub = (this.Resources["MyViewModel"] as MyViewModel).Clubs[0];
            firstClub.Name = "NewName";
        }

where the property grid is defined as:
<telerik:RadPropertyGrid Item="{Binding Clubs[0]}" />

Does this follow your scenario or is there anything that I am missing ?
Furthermore, which version are you working with ? 

Kind regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Andrew
Top achievements
Rank 1
answered on 16 Apr 2013, 06:21 PM
I'm working with version 2013.1.403.40.  

I set the binding in code-behind by setting radpropertygrid.item = mybusinessobject.

I then modify mybusinessobject in code-behind.


An example is as follows (in VB.net)
<Window x:Class="MainWindow"
        Title="MainWindow" Height="350" Width="525">
        <Grid>
        <telerik:RadPropertyGrid Margin="0,37,0,0" Name="RadPropertyGrid1" />
        <TextBox Height="23" HorizontalAlignment="Left" Margin="96,6,0,0" Name="tStoreName" VerticalAlignment="Top" Width="252" />
        <Label Content="My Store Name" Height="28" HorizontalAlignment="Left" Margin="0,6,0,0" Name="Label1" VerticalAlignment="Top" />
    </Grid>
</Window>

Class MainWindow
    Public MyStore As New GroceryStore
 
    Public Sub New()
 
        ' This call is required by the designer.
        InitializeComponent()
 
        ' Add any initialization after the InitializeComponent() call.
        Me.RadPropertyGrid1.Item = MyStore
 
    End Sub
 
 
    Private Sub tStoreName_TextChanged(sender As System.Object, e As System.Windows.Controls.TextChangedEventArgs) Handles tStoreName.TextChanged
        MyStore.Name = tStoreName.Text
    End Sub
End Class
 
Public Class GroceryStore
    Public Property Name As String
End Class

0
Accepted
Maya
Telerik team
answered on 17 Apr 2013, 06:36 AM
Hello Andrew,

Could you verify whether you have INotifyPropertyChanged interface implemented for your business object ?
 

All the best,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Andrew
Top achievements
Rank 1
answered on 17 Apr 2013, 07:49 PM
Maya,

Thanks for the help.  I wasn't aware I had to have INotifyPropertyChanged implemented for the PropertyGrid to function properly.  I didn't see it in any of the examples I went through.  Once I researched how to implement it, it seems to work as expected.
Tags
PropertyGrid
Asked by
Andrew
Top achievements
Rank 1
Answers by
Maya
Telerik team
Andrew
Top achievements
Rank 1
Share this question
or