Sorry for the naive question...
I am a first time user of the telerik WPF controls, I am following the tutorial here to add a RadGridView to my application...
My wpf application is build using MVVM, I am adding the RadGridView control to one of the views, see implementation below...
Note - I have added a reference to
When I run the application, the grid is not displayed at all.
The viewmodel implementation,
Note that the AnalysisResults is ObservableCollection...
If I take the RadGridView out of the equation and use the good old Wpf GridView control, my application works, I can see the grid load up with the values for the same code...
What am I missing?
I am a first time user of the telerik WPF controls, I am following the tutorial here to add a RadGridView to my application...
My wpf application is build using MVVM, I am adding the RadGridView control to one of the views, see implementation below...
<
UserControl
x:Class
=
"SprintAnalyzer.Module.Presentation.Views.MiddleView"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:prism
=
"clr-namespace:Microsoft.Practices.Prism.Interactivity.InteractionRequest;assembly=Microsoft.Practices.Prism.Interactivity"
xmlns:i
=
"clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:interactions
=
"clr-namespace:SprintAnalyzer.Module.Presentation.Interactions"
xmlns:Views
=
"clr-namespace:SprintAnalyzer.Module.Presentation.Views"
mc:Ignorable
=
"d"
d:DesignHeight
=
"300"
d:DesignWidth
=
"300"
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"Lavender"
>
<
telerik:RadGridView
x:Name
=
"radGridView"
AutoGenerateColumns
=
"True"
ItemsSource
=
"{Binding Path=AnalysisResults}"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Result}"
Header
=
"Result"
/>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Category}"
Header
=
"Category"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
Grid
>
</
UserControl
>
Note - I have added a reference to
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
my project already has a reference to the Telerik.Windows.Code, Telerik.Windows.Controls.GridView and Telerik.Windows.Controls.Input. When I run the application, the grid is not displayed at all.
The viewmodel implementation,
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using Microsoft.Practices.Prism.Commands;
using Microsoft.Practices.Prism.Events;
using SprintAnalyzer.Common;
using SprintAnalyzer.Common.Service;
using SprintAnalyzer.Module.Presentation.Models;
using SprintAnalyzer.Module.Presentation.Requests;
using SprintAnalyzer.RulesEngine;
using SprintAnalyzer.Common.Events;
namespace SprintAnalyzer.Module.Presentation.ViewModels
{
public class MiddleViewModel : ViewModelBase
{
private readonly IEventAggregator _eventAggregator;
private ICommand _button;
public string Output { get; private set; }
public ICommand OnClick
{
get { return _button; }
set
{
_button = value;
RaisePropertyChangedEvent("OnClick");
}
}
public MiddleViewModel(IApplicationContextService contextService, IEventAggregator eventAggregator)
{
this._contextService = contextService;
this._eventAggregator = eventAggregator;
this.OnClick = new DelegateCommand(this.Button_Clicked);
_eventAggregator.GetEvent<
AnalysisRunTrigger
>().Subscribe(ExecuteAnalysisRunTrigger, ThreadOption.BackgroundThread);
_eventAggregator.GetEvent<
AnalysisResultEvent
>().Subscribe(OnAnalysisRunResult, ThreadOption.UIThread);
_eventAggregator.GetEvent<
ExceptionRaisedEvent
>().Subscribe(OnExceptionRaised,
ThreadOption.UIThread);
this.AnalysisResults = new ObservableCollection<
AnalysisResult
>();
}
private void OnExceptionRaised(ExceptionDetail obj)
{
// Removed for now
}
private void OnAnalysisRunResult(AnalysisResult analysisResult)
{
AnalysisResults.Add(analysisResult);
}
private static Person CreatePerson()
{
// Removed for now
}
private void SetPeopleExecute()
{
// Removed for now
}
private void GetPersonCallback(Person p)
{
// Removed for now
}
private void CancelCallback()
{
// Removed for now
}
private ObservableCollection<
AnalysisResult
> _analysisResults;
public ObservableCollection<
AnalysisResult
> AnalysisResults
{
get
{
return _analysisResults;
}
set
{
_analysisResults = value;
RaisePropertyChangedEvent("AnalysisResults");
}
}
private void ExecuteAnalysisRunTrigger(string triggerState)
{
try
{
switch (triggerState)
{
case "StartAnalyzis":
rulesFactory.Execute();
break;
}
}
catch (Exception ex)
{
_eventAggregator.GetEvent<
ExceptionRaisedEvent
>().Publish(new ExceptionDetail() { Message = ex.Message });
}
}
private string _message;
private readonly IApplicationContextService _contextService;
public string Message
{
get { return _message; }
set
{
_message = value;
RaisePropertyChangedEvent("Message");
}
}
private void Button_Clicked()
{
//throw new NotImplementedException();
}
}
}
Note that the AnalysisResults is ObservableCollection...
If I take the RadGridView out of the equation and use the good old Wpf GridView control, my application works, I can see the grid load up with the values for the same code...
What am I missing?