or
<telerik:RadScheduleView Name=
"_scheduleView"
AppointmentsSource=
"{Binding Appointments}"
Grid.Row=
"5"
Grid.ColumnSpan=
"2"
CurrentDate=
"2012-10-01"
NavigationHeaderVisibility=
"Collapsed"
MinAppointmentWidth=
"10"
MinAppointmentHeight=
"5"
ShowDialog=
"RadScheduleView_ShowDialog"
ToolTipTemplate=
"{StaticResource AppointmentToolTipTemplate}"
telerik:StyleManager.Theme=
"Metro"
>
<telerik:RadScheduleView.ViewDefinitions>
<telerik:WeekViewDefinition FirstDayOfWeek=
"Monday"
WeekGroupHeaderStringFormat=
"{}{0:dddd(MM/dd/yy)}"
>
</telerik:WeekViewDefinition>
</telerik:RadScheduleView.ViewDefinitions>
</telerik:RadScheduleView>
private
void
playersGrid_AddingNewDataItem(
object
sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
{
e.NewObject =
new
Player();
}
private
void
playersGrid_RowEditEnded(
object
sender, Telerik.Windows.Controls.GridViewRowEditEndedEventArgs e)
{
if
(e.EditAction == GridViewEditAction.Cancel)
{
return
;
}
if
( e.EditAction == GridViewEditAction.Commit)
{
this
.playersGrid.CurrentColumn =
this
.playersGrid.Columns.OfType<GridViewColumn>().First();
this
.playersGrid.BeginInsert();
}
}
<
Window
x:Class
=
"WpfApplication1.TestAutoComplete"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Title
=
"TestAutoComplete"
Height
=
"100"
Width
=
"100"
DataContext
=
"{Binding TestAutoCompleteBinding, Source={StaticResource Locator}}"
>
<
Grid
>
<
StackPanel
Orientation
=
"Vertical"
>
<
telerik:RadAutoCompleteBox
ItemsSource
=
"{Binding Source,Mode=TwoWay}"
AutoCompleteMode
=
"Suggest"
SelectionMode
=
"Single"
SelectedItem
=
"{Binding SelectedItem,Mode=TwoWay}"
DisplayMemberPath
=
"FirstName"
/>
<
Button
Command
=
"{Binding TestCommand}"
Content
=
"test"
/>
</
StackPanel
>
</
Grid
>
</
Window
>
public class TestAutoCompleteViewModel : ViewModelBase
{
public ObservableCollection<
Customer
> _source;
public ObservableCollection<
Customer
> Source
{
get
{
return this._source;
}
set
{
this._source = value;
this.RaisePropertyChanged(() => this.Source);
}
}
private ICommand _testCommand;
public ICommand TestCommand
{
get
{
return this._testCommand;
}
}
private Customer _selectedItem;
public Customer SelectedItem
{
get
{
return this._selectedItem;
}
set
{
this._selectedItem = value;
this.RaisePropertyChanged(() => this.SelectedItem);
}
}
/// <
summary
>
/// Initializes a new instance of the <
see
cref
=
"TestAutoCompleteViewModel"
/> class.
/// </
summary
>
public TestAutoCompleteViewModel()
{
var customers = new List<
Customer
>();
customers.Add(new Customer("testLast1", "testFirst1"));
customers.Add(new Customer("testLast2", "testFirst2"));
customers.Add(new Customer("testLast3", "testFirst3"));
customers.Add(new Customer("testLast4", "testFirst4"));
customers.Add(new Customer("testLast5", "testFirst5"));
customers.Add(new Customer("testLast6", "testFirst6"));
this.Source = new ObservableCollection<
Customer
>(customers);
this._testCommand = new RelayCommand(() => { }, () =>
{
return this.SelectedItem != null;
});
}
}
public
void
OnNavigatedTo(NavigationContext navigationContext)
{
// Called to initialize views during navigation.
// Is this for AgentView?
if
(navigationContext.Uri.ToString().Contains(
"AgentsView"
))
{
// The ID of the item to be displayed is passed as a navigation parameter.
// ToInt32 can throw FormatException or OverflowException.
try
{
int
id = Convert.ToInt32(navigationContext.Parameters[
"PersonID"
]);
if
(id == 0)
return
;
// Retrieve the specified item using the data service.
var agent =
new
DAL.Agent();
_agentsDataService.GetSelectedAgent(id, GetAgentsCallback);
}
catch
(FormatException e)
{
//Console.WriteLine("Input string is not a sequence of digits.");
//return CurrentItem == null ? false : CurrentItem.Id.Equals(id);
}
}
}
private
void
GetAgentsCallback(DAL.Agent agent)
{
_navigatedToAgent = agent;
if
(_navigatedToAgent !=
null
)
{
SelectedAgent = _navigatedToAgent;
}
}
public
DAL.Agent SelectedAgent
{
get
{
return
_selectedAgent; }
set
{
if
(_selectedAgent == value)
return
;
_selectedAgent = value;
RaisePropertyChanged(() => SelectedAgent);
_eventAggregator.GetEvent<AgentSelectedEvent>().Publish(_selectedAgent);
}
}
SelectedItem="{Binding SelectedAgent, Mode=TwoWay}"
DataMemberBinding="{Binding Path=Values[0]}"
public
override
bool
TryGetMember(GetMemberBinder binder,
out
object
result)
{
if
(!
this
.AllFields.Contains(binder.Name))
{
return
base
.TryGetMember(binder,
out
result);
}
result =
this
.Values[
this
.AllFields.IndexOf(binder.Name)];
return
true
;
}