Telerik Forums
UI for WPF Forum
2 answers
204 views
Hello,
I'm facing an issue while filtering the loaded data using the inbuilt column filter. The specific error message I get is as follows:

System.Windows.Data Error: 8 : Cannot save value from target back to source. BindingExpression:Path=IsActive; DataItem='DistinctValueViewModel' (HashCode=49992105); target element is 'CheckBox' (Name=''); target property is 'IsChecked' (type 'Nullable`1') NullReferenceException:'System.NullReferenceException: Object reference not set to an instance of an object.

at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.ArrangeOverride(Size finalSize) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewVirtualizingPanel.cs:line 1517

at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)

at System.Windows.UIElement.Arrange(Rect finalRect)

at System.Windows.ContextLayoutManager.UpdateLayout()

at System.Windows.UIElement.UpdateLayout()

at Telerik.Windows.Controls.GridView.GridViewDataControl.ItemsSourceChanged(Boolean sourceChanged) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 3157

at Telerik.Windows.Controls.GridView.GridViewDataControl.OnItemsChanged(NotifyCollectionChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 8052

at Telerik.Windows.Controls.GridView.BaseItemsControl.OnItemCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\ItemsControl\BaseItemsControl.cs:line 691

at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)

at Telerik.Windows.Data.DataItemCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\DataItemCollection.cs:line 653

at Telerik.Windows.Data.DataItemCollection.OnCollectionViewCollectionChanged(NotifyCollectionChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\DataItemCollection.cs:line 641

at Telerik.Windows.Data.DataItemCollection.Telerik.Windows.Data.IWeakEventListener<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.ReceiveWeakEvent(Object sender, NotifyCollectionChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\DataItemCollection.cs:line 1034

at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\WeakEvents\WeakEvent.cs:line 32

at Telerik.Windows.Data.QueryableCollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.cs:line 669

at Telerik.Windows.Data.QueryableCollectionView.RefreshOverride() in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.cs:line 818

at Telerik.Windows.Data.QueryableCollectionView.RefreshInternal() in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.cs:line 765

at Telerik.Windows.Data.QueryableCollectionView.RefreshOrDefer() in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.cs:line 759

at Telerik.Windows.Data.QueryableCollectionView.InvalidatePagingAndRefresh() in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.cs:line 384

at Telerik.Windows.Data.QueryableCollectionView.OnFilterDescriptorsCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.cs:line 419

at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)

at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)

at Telerik.Windows.Data.RadObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\RadObservableCollection.cs:line 143

at Telerik.Windows.Data.ObservableItemCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\ObservableItemCollection.cs:line 91

at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)

at Telerik.Windows.Data.RadObservableCollection`1.InsertItem(Int32 index, T item) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\RadObservableCollection.cs:line 189

at System.Collections.ObjectModel.Collection`1.Insert(Int32 index, T item)

at System.Collections.ObjectModel.Collection`1.System.Collections.IList.Insert(Int32 index, Object value)

at Telerik.Windows.Data.CollectionHelper.Insert(IList target, IEnumerable newItems, Int32 startingIndex, IEqualityComparer itemComparer) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\CollectionHelper.cs:line 334

at Telerik.Windows.Data.ObservableCollectionManager.HandleCollectionChanged(IList sender, NotifyCollectionChangedEventArgs args) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\Synchronization\ObservableCollectionManager.cs:line 105

at Telerik.Windows.Data.ObservableCollectionManager.Telerik.Windows.Data.IWeakEventListener<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.ReceiveWeakEvent(Object sender, NotifyCollectionChangedEventArgs args) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\Synchronization\ObservableCollectionManager.cs:line 86

at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\WeakEvents\WeakEvent.cs:line 32

at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)

at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)

at Telerik.Windows.Data.RadObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\RadObservableCollection.cs:line 143

at Telerik.Windows.Data.ObservableItemCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\ObservableItemCollection.cs:line 91

at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)

at Telerik.Windows.Data.RadObservableCollection`1.InsertItem(Int32 index, T item) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\RadObservableCollection.cs:line 189

at System.Collections.ObjectModel.Collection`1.Add(T item)

at Telerik.Windows.Controls.GridView.FilteringViewModel.OnPropertyChanged(Object sender, PropertyChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Filtering\FilteringViewModel.cs:line 541

at System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)

at Telerik.Windows.Controls.ViewModelBase.OnPropertyChanged(String propertyName) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\Common\ViewModelBase.cs:line 56

at Telerik.Windows.Controls.GridView.FilteringViewModel.Activate(IFilterDescriptor filter) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Filtering\FilteringViewModel.cs:line 589

at Telerik.Windows.Controls.GridView.FilteringViewModel.OnDistinctValuesItemChanged(Object sender, ItemChangedEventArgs`1 e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Filtering\FilteringViewModel.cs:line 558

at Telerik.Windows.Data.ObservableItemCollection`1.RaiseGenericItemChanged(ItemChangedEventArgs`1 e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\ObservableItemCollection.cs:line 69

at Telerik.Windows.Data.ObservableItemCollection`1.OnItemChanged(ItemChangedEventArgs`1 e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\ObservableItemCollection.cs:line 51

at Telerik.Windows.Data.ObservableItemCollection`1.OnItemPropertyChanged(Object sender, PropertyChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\ObservableItemCollection.cs:line 110

at System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)

at Telerik.Windows.Controls.ViewModelBase.OnPropertyChanged(String propertyName) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\Common\ViewModelBase.cs:line 56

at Telerik.Windows.Controls.GridView.DistinctValueViewModel.set_IsActive(Boolean value) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Filtering\DistinctValueViewModel.cs:line 27'

 

 


Can anyone help me out here? Please do let me know if any other information is required.
Sourav
Top achievements
Rank 1
 answered on 18 Apr 2011
4 answers
455 views
On the top  left corner there is a blank header cell above the row indicator columns. How do I style this?

Also I've managed to style the column header cells, but when I drag them into the grouped row the style changes back to the original blue. How do I apply styles to those little group labels?
Joshua
Top achievements
Rank 1
 answered on 18 Apr 2011
1 answer
313 views
Hi

I have a gridview binding from the databse , i added a select column and a progress bar (through Gridview Data column)
I managed to insert a telerik progress bar inside my gridview , Now i want when i press a button outside that grid , a loop is made on the selected rows and the progress bar of this selected cell is only changing value ,once the loop get to the next row , the previous row progress is 100% and the next row is to be processed and so on

How can i achieve that ?

Below is my Gridview

Thanks in advance


  </Grid>
            <telerik:RadGridView Name="mailGridView" Width="700" Height="250" ItemsSource="{Binding testingreturn}" RowIndicatorVisibility="Collapsed" IsReadOnly="False"
                                         
                                                     ShowColumnHeaders="True" ShowGroupPanel="False"
                                                    
                                                    
                                                     AutoGenerateColumns="False" CanUserInsertRows="False"
                                                     CanUserFreezeColumns="False" CanUserDeleteRows="False"
                                                     CanUserResizeColumns="False" CanUserReorderColumns="False"
                                                     SelectionMode="Extended" AllowDrop="False"
                                                     EnableColumnVirtualization="False"
                                                     EnableRowVirtualization="False" AreRowDetailsFrozen="True" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}">
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding From_Name}" Header="From" IsReadOnly="True" />
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Subject}" Header="Subject" IsReadOnly="True" />
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Email_Date}" Header="Sent Date" IsReadOnly="True" />
                    <telerik:GridViewSelectColumn />
                    <telerik:GridViewDataColumn>
                        <telerik:GridViewDataColumn.CellStyle>
                            <Style TargetType="telerik:GridViewCell">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="telerik:GridViewCell">
                                            <telerik:RadProgressBar Name="progressBar"  Height="15" Width="50" DataContext="{Binding}"></telerik:RadProgressBar>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </telerik:GridViewDataColumn.CellStyle>
                    </telerik:GridViewDataColumn>
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
haytham hosny
Top achievements
Rank 1
 answered on 17 Apr 2011
0 answers
209 views
Hi Telerik Team,
    I have a scenario in my application as follows:
I have a two combo boxes. One ComboBox has Control Types(such as TextBox, RadButton, ...). If I select any Control Type, the corresponding Control Names which I used in my application will display in the second ComboBox.
(For your understanding purpose : I'm using two RadButtons namely Button1 and Button2 in my application. If I select RadButton in first ComboBox, the names "Button1" and "Button2" will display in the second ComboBox). It is done.

Similarly, I wanna get the MenuItem's Names I used under RadGridView. But it is not getting the MenuItems. Please kindly reply me how to acheive this.

The following is the code I've used to get the names of the selected control type:

 

Private

 

 

Sub GetControlNames(ByVal oControl As Object)
Try
    
If IsNothing(oControl) Then GoTo lable1

 

    Dim child As Object 
    
If oControl.GetType.Name = "String" Then GoTo lable1 
    For Each child In LogicalTreeHelper.GetChildren(oControl)

 

        If sSelectedControl = child.GetType.Name Then 
            
cmbControlsName.Items.Add(child.Name)

 

        End If 
        
GetControlNames(child)

 

    Next

 

 

 

lable1:

    Catch ex As Exception 
        
ShowMessage(ex.Message)

 

 

 

    End Try
End Sub

 

 

Note: I have the above said two ComboBoxes and a Frame in one Page and the Frame will load another page namely Page1 in it. The content of the Frame will be passed as the argument for the above function.

Here, I have used the Recursive function(well you know). When the RadGridView is passed as the argument of the function, it jumps to the label "lable1" from "For Each" statement. So, it means the RadGridView doesn't have children. Then, how can I get the MenuItem I've used under RadGridView. Please let me know the solution.

Thanks and Regards,
Azharshah H
Software Developer

azhar
Top achievements
Rank 1
 asked on 16 Apr 2011
2 answers
79 views
I have a class that extends Appointment like so:
public class AppointmentTaskVm : Appointment
{
  private int _appointmentTaskId;
  private bool _isBasketItem;
  private int _position;
  private int? _taskId;
  public int AppointmentTaskId
  {
    get { return _appointmentTaskId; }
    set
    {
      _appointmentTaskId = value;
      OnPropertyChanged("AppointmentTaskId");
    }
  }
  public bool IsBasketItem
  {
    get { return _isBasketItem; }
    set
    {
      _isBasketItem = value;
      OnPropertyChanged("IsBasketItem");
    }
  }
  public int Position
  {
    get { return _position; }
    set
    {
      _position = value;
      OnPropertyChanged("Position");
    }
  }
  public int? TaskId
  {
    get { return _taskId; }
    set
    {
      _taskId = value;
      OnPropertyChanged("TaskId");
    }
  }
  public override IAppointment Copy()
  {
    var newAppointment = new AppointmentTaskVm();
    newAppointment.CopyFrom(this);
    return newAppointment;
  }
  public override void CopyFrom(IAppointment other)
  {
    var task = other as AppointmentTaskVm;
    if (task != null)
    {
      AppointmentTaskId = task.AppointmentTaskId;
      IsBasketItem = task.IsBasketItem;
      Position = task.Position;
      TaskId = task.TaskId;
    }
    base.CopyFrom(other);
  }
}

Dragging the AppointmentTaskVm from a ListBox to the ScheduleView causes the Copy and CopyFrom to fire multiple times. This results in the additional properties in the AppointmentTaskVm to loose thier values.

Subscribing to the AppointmentCreated event of the ScheduleView shows that the new AppointmentTaskVm additional properties are initialised with default values (instead of copying the values from the original AppointmentTaskVm).


David
Top achievements
Rank 1
 answered on 16 Apr 2011
6 answers
322 views

Hi,

I am trying to select values from a bounded combobox inside a GridView.
But after a select it and try to select other the previous selected value is not visible.

below is code in xaml :-
 

<telerik:RadGridView Margin="5,0,0,0" Grid.Row="4" Grid.ColumnSpan="2" Name="gvGISMapFields" Width="610" ShowColumnHeaders="True" ShowGroupPanel="False" Height="250">
<telerik:RadGridView.Columns>
<telerik:GridViewComboBoxColumn Name="MatchingField" DisplayMemberPath="MatchingField" UniqueName="MatchingField" HeaderText="Target Field"  IsFilterable="False" IsGroupable="False" IsReorderable="False" IsSortable="False" TextAlignment="Center" Width="250"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>

below is code in xaml.cs :-

GridViewComboBoxColumn matchingField = (GridViewComboBoxColumn)gvMapFields.Columns[1];
matchingField.ItemsSource = matchingGISFields;

Helio
Top achievements
Rank 2
 answered on 15 Apr 2011
3 answers
697 views
Hello,
    I have a checkbox column in my grid but it appears left justified. I want to center it but have not found the command or event where to do this.
Any help would be appreciated.
Thanks

Vanya Pavlova
Telerik team
 answered on 15 Apr 2011
1 answer
121 views
I am just starting out, and trying to use data binding to display a parent child relationship.

I need to first have the user select in a ComboBox my List of "Currency" objects and display in a Grid the related "CurrencyRates" collection of the selected currency object

I can see the list of currencies in the combo when I bind the ItemsSource property to the DataContext
<telerik:RadComboBox ItemsSource="{Binding}" DisplayMemberPath="Name" x:Name="cboCurrencyList"  />


I am not sure how to get a Grid to show the child collection CurrencyRates.... I've tried the code below but didn't work
Source="{Binding ElementName=cboCurrencyList, Path=SelectedValue}"/>

I am using EF4

Valeri Hristov
Telerik team
 answered on 15 Apr 2011
1 answer
57 views
Hi,

I'm trying to show a radgridview into a radtreelistview item.
Now i bind the treelistview with "Capitulos" Items and i have the next structure:

                 Capitulo 1
                        Capitulo 1.1
                               Capitulo 1.1.1
                 Capitulo 2
                 Capitulo 3


I need to show this one:

                    Capitulo 1
                        Capitulo 1.1
                            Product c
                            Product d
                            Product e
                                Capitulo 1.1.1
                                        Product a
                                        Product b
                    Capitulo 2
                    Capitulo 3
                        

        
Ivan Ivanov
Telerik team
 answered on 15 Apr 2011
2 answers
173 views
Hi Telerik,

I've had a somewhat similar thread sometime ago, but here is what I need to do:

Basically what I want to achieve is to add some custom object to the CalendarButtonContent for my DataTemplate to access.

I have created a template selector and finding that the given date is a Holiday, then returning my HolidayTemplate.

public class CalendarButtonTemplateSelector : DataTemplateSelector
{
    public override DataTemplate SelectTemplate(object item, DependencyObject container)
    {
        CalendarButtonContent content = item as CalendarButtonContent;
        if (content != null && content.ButtonType == CalendarButtonType.Date)
        {
            if (CentralCalendarWindow.CalendarViewItems != null && CentralCalendarWindow.CalendarViewItems.Exists(c => c.Date == content.Date))
            {
                CalendarViewItem calendarViewItem = CentralCalendarWindow.CalendarViewItems.Find(c => c.Date == content.Date);
                if (calendarViewItem.IsHoliday)
                {
                    return HolidayTemplate;
                }
            }
        }
    }
}

In XAML I would like my template to achieve something like the following (where CustomText is the object somehow added to the CalendarButtonContent or otherwise referenced):

<DataTemplate>
    <StackPanel>
        <TextBlock Text="{Binding Text}" />
        <TextBlock Text="{Binding CustomText}" />
    </StackPanel>
</DataTemplate>

I would be happy if I could somehow from my template just access some custom data outside the scope of the CalendarButtonContent, i.e. some static public data, if this would somehow be possible, but I guess that has not really anything to do with your Calendar control :)

Thanks in advance!
Best regards,
Kasper Schou
Kasper Schou
Top achievements
Rank 1
 answered on 15 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?