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

Outlook template enable multiple row selected mark unread/read

14 Answers 75 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Khoa
Top achievements
Rank 1
Khoa asked on 09 Oct 2018, 08:31 AM

Hi,
I'm testing your Outlook Template for visual studio, and I see that by marking an e-mail in the data-grid, you can mark the e-mail as read/unread, which make the font bold for the selected e-mail. But this read/unread command only apply for a single marked e-mail in the data-grid. 

I have now made it possible to mark multiple e-mails in the data-grid, but when I upon read/unread command, only the first e-mail I selected is marked unread/read and the rest is ignored. 
How do I enable the read/unread command to apply for all the selected e-mails?

Is it possible to set the documenthost window empty at application startup, instead of viewing the first mail?

14 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 12 Oct 2018, 07:27 AM
Hello Khoa,

The gridview that shows the e-mails in the example is adjusted for a single selection so the command that marks the mail supports only a single item actions. If you want to enable this to happen for multiple items you will need to extend the Outlook example a bit. You can use the following guidelines as a base:
  • First enable multiple selection by setting the SelectionMode=Multiple on the RadGridView control.
  • Remove the SelectedItem binding from the RadGridView definition in XAML and the SelectedEmail property from the view model.
  • Create a SelectedEmails property (a collection) in the view model and bind it to the SelectedItems property of the RadGridView control. Note that the SelectedItems cannot be bound directly. You will need to use some custom code for this. Fortunately, we already have such implementation which you can get from the BindingSelectedItemsFromViewModel SDK example.
  • Find all the places in the code where the SelectedEmail property is used and replace it with the new SelectedItems property (the collection).

To avoid showing the first mail when you start up the application set the IsSynchronizedWithCurrentItem property of RadGridView to False.

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Khoa
Top achievements
Rank 1
answered on 12 Oct 2018, 08:01 AM

Thanks a lot! 

Is there a way I can use the ribbon tab to change the "view" ?

Like if I add another ribbon tab and upon change of tab, it retrieves the new view? :)

0
Khoa
Top achievements
Rank 1
answered on 15 Oct 2018, 10:13 AM

I noticed that the selectStyle automatically resets when you try to click on an item.

Is there a way to only remove the selectStyle if read turns to unread?

0
Khoa
Top achievements
Rank 1
answered on 15 Oct 2018, 11:14 AM

Forget that question. I managed to fix it.

Another problem that has occured is that, the row doesn't instantly apply the selectorstyle, but I have to refresh the grid in order to get the new updates. 

How can I fix this?

0
Martin Ivanov
Telerik team
answered on 17 Oct 2018, 07:49 AM
Hello Khoan,

In order to change the view when you select different tab in the ribbon control, you will need to write custom logic. For example, you can subscribe to the SelectionChanged event of RadRibbonView and inside the event handler change the content "ToolBarSector" ContenControl.

As for the row style selector, I couldn't reproduce this. You can double check if the selector is properly defined. 

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Khoa
Top achievements
Rank 1
answered on 17 Oct 2018, 10:04 AM

What I notice now is when I do a change in a property, the grid also changes instantly.

Is there a way I can make the changes only happen when a command is called?

Is there a way to force the grid to refresh upon invoke of a command.

0
Martin Ivanov
Telerik team
answered on 19 Oct 2018, 06:31 AM
Hello Khoa,

Can you please tell me what properties you are changing when the gridview gets updated? Or those properties on the gridview row models? If so, you might be able to stop the bindings to reflect to the UI by skipping the PropertyChanged event raising in the setters of the properties. For example, you can go to the model class that presents the rows in the gridview and remove the call to this.OnPropertyChanged("property name") from the property setters. Then you can call the OnPropertyChanged of all properties at once in the button's command handler. For example:
public void ExecuteCommand()
{
    this.OnPropertyChanged("CarbonCopy");
    this.OnPropertyChanged("Content");
    this.OnPropertyChanged("Received");
    //etc.
}
Or alternatively, change the UpdateSourceTrigger of all bindings that you don't want to be evaluated on the UI to Explicit and update them manually when needed. However, you should keep in mind that the DataMemberBinding of the column overrides the trigger and manually updates the bindings. See the following article to see how to avoid this.

To refresh the grid on a command execution you can try its Rebind() method that can be called in the command.

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Khoa
Top achievements
Rank 1
answered on 19 Oct 2018, 07:38 AM

Hi, for example from and to property. 

It changes, but it seems like I need to refresh the grid in order to get the changes. If I close the group and re-open it, the changes appear.

0
Khoa
Top achievements
Rank 1
answered on 19 Oct 2018, 07:40 AM

how can I access my gridView.Rebind();?

It seems like I can't find the reference to the gridView when I try to find it.

0
Khoa
Top achievements
Rank 1
answered on 19 Oct 2018, 08:08 AM

Right now my grid is displaying a queryable newsGroup, and the selected item is showing a observablecollection.

 

I tried to remove the onpropertyChanged for queryable but it doesn't seem to work.

0
Martin Ivanov
Telerik team
answered on 24 Oct 2018, 06:52 AM
Hello Khoa,

I am afraid that without the changes applied in the demo I can't point you in the right direction. I could suggest you to open a new support ticket from telerik.com and send a project there. This way your case could be tested and a proper solution would be suggested. Also, keep in mind the requirements you have are related more to the application logic than the controls themselves so I can't guarantee that we can fully assist you with that.

Anyway, let me try target your questions.
  • for example from and to property. It changes, but it seems like I need to refresh the grid in order to get the changes. If I close the group and re-open it, the changes appear.

    I got confused here. In the reply before this you mentioned that changing those properties the grid updates instantly. But here it sounds like the grid is not updated. Can you please clarify what is the currently experienced result and what is the expected one?

    Note that I've tested changing the from and to properties (Sender and Recipient) and the gridview is updated instantly without the need to refresh it.

  • how can I access my gridView.Rebind();?

    There are different approaches to access the gridview. However, the easiest I can think of is to use the ChildrenOfType<T>() method in code-behind. Here is an example in code:
    RadGridView gridView = this.ChildrenOfType<RadGridView>().FirstOrDefault(x => x.Name == "gridView");
  • Right now my grid is displaying a queryable newsGroup, and the selected item is showing a observablecollection.

    Can you please explain what it means that the selected item is showing an observable collection?

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Khoa
Top achievements
Rank 1
answered on 24 Oct 2018, 01:59 PM

Hi, would this work in the viewmodel.command?

 

                    RadGridView gridView = this.ChildrenOfType<RadGridView>().FirstOrDefault(x => x.Name == "gridView");

 

Because I can't seem to get it to work...

0
Khoa
Top achievements
Rank 1
answered on 24 Oct 2018, 04:23 PM

Is there a easy way to get 2 document host? Like in one column and 2 rows on the outlook template?

Because I want be able to scroll in the document host to see all the text and textblocks that the documenthost consist of. At the moment it seems like it just float down out of the view, when it reach the maximum space.

 

Another question is; How can I make the outlookbar (the left panel with treeview) to be minimized by default? Or maybe move it down to the status bar, so it would open if I click there (to save space)?

 

 

0
Martin Ivanov
Telerik team
answered on 29 Oct 2018, 11:28 AM
Hello Khoa,

This won't work in the view model command -  " RadGridView gridView = this.ChildrenOfType<RadGridView>().FirstOrDefault(x => x.Name == "gridView");". This is because the ChildrenOfType<T>() method is traversing visual tree of the element which calls the method. The view model is not a UI element therefore it doesn't have a visual tree and you cannot find the gridView there. Instead you will need to call the method in the view that holds the RadGridView control. For example, the MainWindow.xaml.cs code-behind or the code behind of the view with the gridview control.

To minimize the OutlookBar by default, set its IsMinimized property to True.

As for the document host scrolling, note that in the original implementation of the Outlook-inspired application, the scrolling work properly. Can you please check how the document host is adjusted and try this also on your side.

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Khoa
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Khoa
Top achievements
Rank 1
Share this question
or