Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF GridView Not Updating On Observable Collection Change
    primarykey
    data
    text
    <p>I have a Telerik RadGridView Bound to ObservableCollection of defined type.. On Updating the value of a particular property in that type, the corresponding Observable collection is getting updated but not the RadGridView..</p> <p><strong>Below is the XAML:</strong> </p> <pre><code>&lt;ComboBox Grid.Column="4" Width="100" Margin="4" ItemsSource="{Binding Path=ResultUnits, Mode=OneTime}" SelectedValue="{Binding Path=ResultUnit}"/&gt; &lt;telerik:RadGridView ItemsSource="{Binding Path=Results, Mode=TwoWay}" FooterRowStyle="{StaticResource GridViewFooterStyle}" Width="{Binding RelativeSource={RelativeSource AncestorType= ScrollViewer}, Path=ActualWidth}" ColumnWidth="*" RowIndicatorVisibility="Collapsed" EditTriggers="None" IsFilteringAllowed="False" AutoGenerateColumns="False" AllowDrop="False" CanUserFreezeColumns="False" CanUserReorderColumns="False" CanUserDeleteRows="False" CanUserInsertRows="False" ShowGroupPanel="False" ShowColumnFooters="True"&gt; &lt;telerik:RadGridView.Columns&gt; &lt;telerik:GridViewDataColumn Header="Quantity" DataMemberBinding="{Binding Path=Quantity}"/&gt; &lt;/telerik:RadGridView.Columns&gt; &lt;/telerik:RadGridView&gt; </code></pre> <p><strong>Below is the View Model Code:</strong></p> <pre><code>public class ViewModel { private const decimal PoundsToKilograms = 0.45359237M; private const decimal GramstoPound = 0.00220462262M; private ObservableCollection&lt;Result&gt; results; public EnvironmentalSummaryViewModel() { this.results= new ObservableCollection&lt;Result&gt;(); } public ObservableCollection&lt;Result&gt; Results{ get { return this.results; } set { this.results = value; } } public string ResultUnit { get { return this.resultUnit; } set { if (this.resultUnit != value) { this.resultUnit = value; this.UpdateGridViewValuesOnResultUnitChanged(); } } } private void UpdateGridViewValuesOnResultUnitChanged() { bool isEnglish = this.resultUnit == this.resultUnits[0]; this.results.ToList().ForEach(result =&gt; { decimal weight = isEnglish ? result.Weight * GramstoPound * 1000 : environmental.Weight * PoundsToKilograms; result.Weight = Math.Round(weight, 2); }); ((IHaveOnPropertyChangedMethod) this).OnPropertyChanged("Results"); } } </code></pre> <p><strong>Object Class:</strong></p> <pre><code>public class Result{ public decimal Weight { get; set; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload