Hi,
I use RadGridView in a MVVM WPF 4.5 application (running on windows 8 if that matters).
I use the latest internal build 2013.2.708.45 (before I use 617 with the same problem).
Everything worked fine till I added a user request (MessageBox) in the method which fills the data.
To reproduce this behavior I made simple app and had to find out that I don't even need the MessageBox to reproduce the problem.
The problem - RadGridView doesn't display any data until I "force" a redraw, either by changing the window size or by doing a change to the data.
To proof that my solution works in general I also added a WPF DataGrid - and yes this thing works as expected.
I simply created a WPF 4.5 application and changed MainWindow.xaml to
In code behind I have
When I start the application the RadGridView shows no rows.
If I add a new row (with the button at the bottom) the data shows up as expected. The same happens if I change the window size.
Manfred
I use RadGridView in a MVVM WPF 4.5 application (running on windows 8 if that matters).
I use the latest internal build 2013.2.708.45 (before I use 617 with the same problem).
Everything worked fine till I added a user request (MessageBox) in the method which fills the data.
To reproduce this behavior I made simple app and had to find out that I don't even need the MessageBox to reproduce the problem.
The problem - RadGridView doesn't display any data until I "force" a redraw, either by changing the window size or by doing a change to the data.
To proof that my solution works in general I also added a WPF DataGrid - and yes this thing works as expected.
I simply created a WPF 4.5 application and changed MainWindow.xaml to
<
Window
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
x:Class
=
"RGrid.MainWindow"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"2*"
/>
<
RowDefinition
Height
=
"2*"
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
telerik:RadGridView
Grid.Row
=
"0"
ItemsSource
=
"{Binding TransferModules}"
SelectionMode
=
"Extended"
ShowInsertRow
=
"false"
CanUserDeleteRows
=
"False"
CanUserInsertRows
=
"False"
CanUserReorderColumns
=
"False"
ShowGroupPanel
=
"False"
AutoGenerateColumns
=
"False"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"Modul"
DataMemberBinding
=
"{Binding ShortName}"
Width
=
"100"
IsFilterable
=
"False"
IsReadOnly
=
"True"
/>
<
telerik:GridViewDataColumn
Header
=
"Beschreibung"
DataMemberBinding
=
"{Binding Description}"
Width
=
"200"
IsFilterable
=
"False"
IsReadOnly
=
"True"
/>
<
telerik:GridViewDataColumn
Header
=
"Status"
DataMemberBinding
=
"{Binding TransferStatus}"
Width
=
"*"
IsFilterable
=
"False"
IsReadOnly
=
"True"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
<
DataGrid
Grid.Row
=
"1"
ItemsSource
=
"{Binding TransferModules}"
SelectionMode
=
"Extended"
CanUserDeleteRows
=
"False"
CanUserReorderColumns
=
"False"
AutoGenerateColumns
=
"False"
>
<
DataGrid.Columns
>
<
DataGridTextColumn
Header
=
"Modul"
Binding
=
"{Binding ShortName}"
Width
=
"100"
IsReadOnly
=
"True"
/>
<
DataGridTextColumn
Header
=
"Beschreibung"
Binding
=
"{Binding Description}"
Width
=
"200"
IsReadOnly
=
"True"
/>
<
DataGridTextColumn
Header
=
"Status"
Binding
=
"{Binding TransferStatus}"
Width
=
"*"
IsReadOnly
=
"True"
/>
</
DataGrid.Columns
>
</
DataGrid
>
<
Button
Grid.Row
=
"2"
Click
=
"Button_Click"
Content
=
"Add item"
HorizontalAlignment
=
"Left"
VerticalAlignment
=
"Center"
/>
</
Grid
>
</
Window
>
In code behind I have
using
System;
using
System.Collections.Generic;
using
System.Collections.ObjectModel;
using
System.Linq;
using
System.Windows;
namespace
RGrid {
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public
partial
class
MainWindow : Window {
public
class
TM {
public
String ShortName {
get
;
set
; }
public
string
Description {
get
;
set
; }
public
string
TransferStatus {
get
;
set
; }
}
public
ObservableCollection<TM> TransferModules {
get
;
set
; }
private
List<TM> _TModules;
public
MainWindow() {
_TModules =
new
List<TM>();
for
(
int
nX = 0; nX < 5; nX++) {
_TModules.Add(
new
TM { Description =
"Des "
+ nX.ToString(), ShortName =
"SN"
+ nX.ToString(), TransferStatus =
"OK"
});
}
//comment the following line to see if it fail without messagebox too
_TModules[1].TransferStatus =
"ERROR"
;
TransferModules =
new
ObservableCollection<TM>();
InitializeComponent();
Loaded += MainWindow_Loaded;
DataContext =
this
;
}
void
MainWindow_Loaded(
object
sender, RoutedEventArgs e) {
foreach
(TM tM
in
_TModules) {
if
(tM.TransferStatus !=
"OK"
) {
if
(MessageBox.Show(
"Data not OK."
+ Environment.NewLine +
"Add anyways?"
,
"Please confirm"
, MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) != MessageBoxResult.Yes) {
continue
;
}
}
TransferModules.Add(tM);
}
}
private
void
Button_Click(
object
sender, RoutedEventArgs e) {
TransferModules.Add(
new
TM { Description =
"Des "
, ShortName =
"SN"
, TransferStatus =
"OK"
});
}
}
}
When I start the application the RadGridView shows no rows.
If I add a new row (with the button at the bottom) the data shows up as expected. The same happens if I change the window size.
Manfred