This is a migrated thread and some comments may be shown as answers.

Grouping is not done until some click event is raised

0 Answers 32 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
charan
Top achievements
Rank 1
charan asked on 27 Jul 2011, 05:52 AM
Hi,

I am doing advanced grouping by following the tutorial.

I have one requirement.Where i may check/uncheck the staff in the Gridview.Based on the Check/uncheck RaisePropertychanged is raised. ( Calling the UpdateGroupFilter() method).

My issue is until i click on the Day or Month etc.. Button the Grouping is not done.

Grouping works fine with the Checkboxes outside the Gridview.

Could you please suggest me the solution as early as possible ?

 

private Func<object, bool> groupFilter;

 public Func<object, bool> GroupFilter

 {

 get { return groupFilter; }

 private set

 {

 

OnGroupFilterChanging(

value);

 this.groupFilter = value;

 this.RaisePropertyChanged("GroupFilter");

 OnGroupFilterChanged();

}

}

 partial void OnGroupFilterChanging(Func<object, bool> value);

partial void OnGroupFilterChanged();

private bool filter = false;

 

public bool Filter

 {

get { return filter; }
set

 {

 if (filter != value)

 {

OnFilterChanging(value);

 filter = value;

this.RaisePropertyChanged("Filter");

 OnFilterChanged();

}

}

}

 

 

partial void OnFilterChanging(bool value);
void
OnFilterChanged()

 {

 AppointmentViewModel viewModel = new AppointmentViewModel();

 viewModel.UpdateGroupFilter();

}

}

 

partial void OnStaffWrappersChanging(ObservableCollection<StaffWrapper> value);

 partial void OnStaffWrappersChanged();

 public void UpdateGroupFilter()

 {

 this.GroupFilter = new Func<object, bool>(this.GroupFilterFunc);

 }

 

 

private bool GroupFilterFunc(object groupName)

 {

 IResource resource = groupName as IResource;

 return resource == null ? true : this.GetEnabledGroups(new Guid(resource.ResourceName)).Contains(new Guid(resource.ResourceName));

 }

private IEnumerable<Guid> GetEnabledGroups(Guid resourceName)

 {

 List<Guid> enabledGroups = new List<Guid>();

 if (this.ShowAppointmentType)

 {

AppointmentType appointmentType = AppointmentTypes.FirstOrDefault(o => o.AppointmentTypeId == resourceName);

if (appointmentType != null)

 {

 if (!enabledGroups.Contains(appointmentType.AppointmentTypeId))

 enabledGroups.Add(appointmentType.AppointmentTypeId);

}

}

 

 

if (this.ShowStaff)

 {

 Staff staff = Staffs.FirstOrDefault(o => o.StaffId == resourceName);

 if (staff != null)

 {

 if (!enabledGroups.Contains(staff.StaffId))

 enabledGroups.Add(staff.StaffId);

}

}

 

 if (this.StaffWrappers != null)

 {

 StaffWrapper staffWrapper = StaffWrappers.FirstOrDefault(o => o.Staff.StaffId == resourceName && o.Filter == true);

if (staffWrapper != null)

{

 if (!enabledGroups.Contains(staffWrapper.Staff.StaffId))

 enabledGroups.Add(staffWrapper.Staff.StaffId);

}

}

return enabledGroups;

 }

Regards,

Charan 

No answers yet. Maybe you can help?

Tags
ScheduleView
Asked by
charan
Top achievements
Rank 1
Share this question
or