Telerik Forums
UI for WPF Forum
1 answer
369 views
I'm using the RadGridView in an MVVM application. The SortingState of each column is bound to a property (one per column) in my ViewModel. When I set a new value to these properties in code I expect the sorting of the corresponding column to be updated. However, that doesn't work as expected. The column header indicates that the column is ordered as I specified, but the rows are not ordered. Also, if I update the data in the GridView the sorting I set through code completely disappears.

I've found one perticular interesting scenario:
1. I start the application and load some data into the GridView.
2. I sort the data by column A by clicking the header of this column (works fine).
3. I press a button that invokes a command in the ViewModel that sets the SortingState of column A to SortingState.None (removes the sorting that is) and sets the SortingState of column B to SortingState.Ascending
4. The GridView header now indicates that the data should be sorted ascending by column B and not sorted by any other column. However, the rows are still sorted as before (by column A).
5. Now I fetch some new data (completely replace the old data).
6. The GridView now reverts into my previous sorting order, that is to sort by column A. This is both indicated by the GridView header and by the way the rows are actually sorted.

What am I doing wrong?

Here's how my XAML looks:
<tgv:RadGridView ItemsSource="{Binding Path=DataRows, Mode=OneWay}" AutoGenerateColumns="False" Grid.Row="0">
    <tgv:RadGridView.Columns>
        <tgv:GridViewDataColumn Header=Column A"
            DataMemberBinding="{Binding Path=Id}"
            SortingState="{Binding Path=SortingStateColumnA, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
        <tgv:GridViewDataColumn Header="Column B"
            DataMemberBinding="{Binding Path=FirstName}"
            SortingState="{Binding Path=SortingStateColumnB, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
    </tgv:RadGridView.Columns>
</tgv:RadGridView>
<Button Grid.Row="1" Command="{Binding Path=ApplySortOrderCommand, Mode=OneTime" />

And the ViewModel:
public class MainWindowViewModel : ViewModelBase
{
    private RadObservableCollection<DataRowViewModel> _dataRows;
    private RelayCommand _applySortOrderCommand;
    private SortingState _sortingStateColumnA = SortingState.None;
    private SortingState _sortingStateColumnB = SortingState.None;
 
    public MainWindowViewModel()
    {
        _dataRows = new RadObservableCollection<DataRowViewModel>();
    }
 
    public RadObservableCollection<DataRowViewModel> DataRows
    {
        get
        {
            return _dataRows;
        }
    }
     
    public SortingState SortingStateColumnA
    {
        get
        {
            return _sortingStateColumnA;
        }
        set
        {
            if (value != _sortingStateColumnA)
            {
                _sortingStateColumnA = value;
                OnPropertyChanged("SortingStateColumnA");
            }
        }
    }
     
    public SortingState SortingStateColumnB
    {
        get
        {
            return _sortingStateColumnB;
        }
        set
        {
            if (value != _sortingStateColumnB)
            {
                _sortingStateColumnB = value;
                OnPropertyChanged("SortingStateColumnB");
            }
        }
    }
 
    public ICommand ApplySortOrderCommand
    {
        get
        {
            if (_applySortOrderCommand == null)
            {
                _applySortOrderCommand = new RelayCommand(param => ApplySortOrder());
            }
            return _applySortOrderCommand;
        }
    }
 
    private void ApplySortOrder()
    {
        SortingStateColumnB = SortingState.Ascending;
    }
}

Code to fetch data removed for brevity. Note that this is not my actual code so please disregard typos.
Vlad
Telerik team
 answered on 26 May 2011
1 answer
113 views
Hi,

in my gridview, I have a column base on a bool value and for each rows, for this column, a checkbox is visible. I would like to know if it's possible to center horizontally those checkboxes?

Thank's
Vanya Pavlova
Telerik team
 answered on 26 May 2011
3 answers
263 views
Hi,

im using a TreeListView and would like to get an event, when the selection in a ComboboxColumn changes. I can't find any event helping me. Here is my XAML:

		<telerik:RadTreeListView Name="rtlvQuery" Grid.Column="0" Grid.Row="0" IsDragDropEnabled="true" Margin="30" AutoGenerateColumns="False" >
			<telerik:RadTreeListView.ChildTableDefinitions>
				<telerik:TreeListViewTableDefinition ItemsSource="{Binding Filters}" />
			</telerik:RadTreeListView.ChildTableDefinitions>
			<telerik:RadTreeListView.Columns>
				<telerik:GridViewDataColumn DataMemberBinding="{Binding IsActive}" Header="Active" />
				<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Name" />
				<telerik:GridViewDataColumn DataMemberBinding="{Binding Description}" Header="Description"/>
				<telerik:GridViewComboBoxColumn ItemsSourceBinding="{Binding AvailableFilterTypes}" DataMemberBinding="{Binding FilterType}"  
												Header="Type" SelectedValueMemberPath="Value"  DisplayMemberPath="DisplayName" />
				<telerik:GridViewDataColumn DataMemberBinding="{Binding IsNegated}" Header="Negate"/>
 
			</telerik:RadTreeListView.Columns>
		</telerik:RadTreeListView>

I use a ItemSourceBinding because the available Combobox is bound to a filtered List of EnumMemberViewModel build by EnumDataSource.FromType<FilterType>( );

I tried the following, that I found in the forum for RadGridView, but thta doesn't seem to work in TLV:

		<Grid.Resources>
			<Style TargetType="telerik:RadComboBox" >
				<EventSetter Event="SelectionChanged" Handler="ComboBox_SelectionChanged" />
			</Style>
		</Grid.Resources>

Any idea, how I could solve this?

Thanks
Hans




Pavel Pavlov
Telerik team
 answered on 26 May 2011
1 answer
128 views
Hi,

i am trying to change the selection of a RadComboBox with seperate Buttons.
One to select the previous entry in the RadComboBox and one to select the next.
Is there a way to do that with build-in commands?
Or is there another possibility to do that without Code-Behind?
Valeri Hristov
Telerik team
 answered on 26 May 2011
5 answers
194 views
Greetings,

I'm using the RadGridView inside of a Windows Forms ElementHost and have lost the ability to drag the column headers. I'm using Q1 2010 release. It worked great for us in Q3 2009 SP2. Any Suggestions for a work around would be great.

Thanks much
~Boots
Ariel
Top achievements
Rank 1
 answered on 26 May 2011
12 answers
295 views
Hello,

I'm not sure if this is working as designed or a bug, but here is the issue.

We have a GridView hosted in a RadPane.  If the Pane is pinned, grouping works great.  If the pane is unpined, you can hover over it to expand the pane, but none of the grouping features work until you pin the pane again.

On a secondary note, I also noticed the sorting also get's lost when the pane is pinned and unpinned.

We are using the latest release 2010.2 812 of the controls.

Here is a quick sample on how we are using it:
<telerik:RadDocking>
    <telerik:RadDocking.DocumentHost>
        <telerik:RadSplitContainer>
            <telerik:RadPaneGroup />
        </telerik:RadSplitContainer>
    </telerik:RadDocking.DocumentHost>
    <telerik:RadSplitContainer InitialPosition="DockedLeft">
        <telerik:RadPaneGroup>
            <telerik:RadPane Title="Pane 1" CanUserClose="False" CanFloat="False" CanDockInDocumentHost="False">
                <telerik:RadGridView x:Name="radGridView" AutoGenerateColumns="False">
                    <telerik:RadGridView.Columns>
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding LastName}" Header="Last Name"/>
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding Married}" Header="Is Married"/>
                    </telerik:RadGridView.Columns>
                </telerik:RadGridView>
            </telerik:RadPane>
        </telerik:RadPaneGroup>
    </telerik:RadSplitContainer>
</telerik:RadDocking>
Tsvyatko
Telerik team
 answered on 26 May 2011
1 answer
136 views
Hi,

I have a copy menu with command = Copy and CommandTarget=MyRadGridView. Now when i click copy and paste it in excel, it pastes the name of the binding object for the columns where I'm using converter to concatenate two fields. For columns which have direct binding defined it copies the data.

Copy command:

 

 

 

<MenuItem Header="Copy" InputGestureText="Ctrl+C" Command="ApplicationCommands.Copy" CommandTarget="{Binding ElementName=vpRadGridView}"/>

GridColumns
1.

 

 

 

 

 

<telerik:GridViewDataColumn

 

 

 

 

 

 

 

 

 

 

 

Header="Verification Path Pair"

 

 

 

 

 

 

 

 

 

 

 

UniqueName="VerificationPathPair"

 

 

 

 

 

 

 

 

 

 

 

DataMemberBinding="{Binding Path=., Converter={StaticResource VPPair}}"

 

 

 

 

 

 

 

 

 

 

 

/>

 

2.

<

 

 

telerik:GridViewDataColumn

 

 

 

Header="Verification Path ID"

 

 

 

UniqueName="VerificationPathID"

 

 

 

DataMemberBinding="{Binding Name, ValidatesOnExceptions=True, Mode=OneWay, ValidatesOnDataErrors=True}"

 

 

 

/>

 

Copy Results:

MySolution.OrmNhib.BusinessObjects.OnepValidochpath

   VP1
It should have copied actual data for column 1 also as it did for column 2. Any suggestion?

Ivan Ivanov
Telerik team
 answered on 26 May 2011
1 answer
72 views
I get the following error in my code after upgrading the controls. The problem is, even the demo of group header still uses the OrientedGroupHeaderContentTemplateSelector object. What gives?


Error 10 'Telerik.Windows.Controls.OrientedGroupHeaderContentTemplateSelector' is obsolete: 'Please, use the StringFormat properties, the System.Windows.Controls.GroupHeaderTemplateSelector or inherit from System.Windows.Controls.ScheduleViewDataTemplateSelector instead.' C:\Users\rodneyy\Documents\MetrixDevelopment\MetrixDevelopment\Client\Metrix.UI\Managers\RepairCenterComponent\RepairBoardManager.cs 62 148 Metrix.UI

This is the line that produces the error...
repairBoardScheduleView.GroupHeaderContentTemplateSelector = Application.Current.FindResource("GroupHeaderContentTemplateSelector") as OrientedGroupHeaderContentTemplateSelector;

So apparently this works but I don't understand why I am casting this resource to something that it is not....
repairBoardScheduleView.GroupHeaderContentTemplateSelector = Application.Current.FindResource("GroupHeaderContentTemplateSelector") as ScheduleViewDataTemplateSelector;
Yana
Telerik team
 answered on 26 May 2011
3 answers
123 views
Hello there,

I have an issue with SelectedItemRemoveBehaviour of RadPaneGroup - it is either not working as expected or I don't understand what is expected. I am using it to control which document is selected when the current one has been closed. It doesn't matter which value I use, everytime the first item (left to right) is selected.

Can you help me understand this property, please? Is there a bug, or I am missing something. Let me know if you need me to provide you with a basic project with this issue reproduced.

As a side note - I am adding dynamically items to RadPaneGroup of type RadDocumentPane. I would like when a user closes the current document, then the previous used one is selected. I know how to achieve this programatically, but I found this property and I thought I can use it.

Thanks for your assistance.

Best Regards,

Ivan.
Miroslav Nedyalkov
Telerik team
 answered on 26 May 2011
1 answer
83 views
When i set the properties MajorTickLength and MinorTickLength, at TimeLineViewDefinition, to 1day the application slows down when the control is rendered (maximizing or minimizing the window, scrolling, getting focus, ...). Reading the forum if found how to solve this problem out when scrolling (adding a container), but i haven't found a solution for the other issues.

Here it is the definition for the control:

<

 

telerik:RadScheduleView

 

 

x:Name="scheduleView"

 

 

 

AppointmentsSource="{Binding ImmovilizationModel.ImmovilizationAppointments}"

 

 

GroupDescriptionsSource="{Binding ImmovilizationModel.GroupDescriptions}">

 

 

 

<telerik:RadScheduleView.ViewDefinitions>

 

 

 

<telerik:TimelineViewDefinition>

 

 

 

<telerik:TimelineViewDefinition.MajorTickLength>

 

 

 

<telerik:FixedTickLengthProvider />

 

 

 

</telerik:TimelineViewDefinition.MajorTickLength>

 

 

 

<telerik:TimelineViewDefinition.MinorTickLength>

 

 

 

<telerik:FixedTickLengthProvider />

 

 

 

</telerik:TimelineViewDefinition.MinorTickLength>

 

 

 

</telerik:TimelineViewDefinition>

 

 

 

</telerik:RadScheduleView.ViewDefinitions>

 

 

 

</telerik:RadScheduleView>

 


¿Is there anything i can do to speed up control rendering?
Valeri Hristov
Telerik team
 answered on 26 May 2011
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
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
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
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?