AWG Blogs

Thursday, December 13, 2012

Testing Email in SharePoint Dev Environment

Tried this. Installing local dummy SMTP not possible. Finally just configured the local SMTP Virtual Server in IIS 6.0 Manager, setting the FQDN of the local server in Advanced Delivery, leaving Smart host empty. Then in used the local server for Outbound SMTP server in CA Outgoing E-Mail Settings.

Try adding a user to a group and leaving send email checked, and, bingo, email appears in c:\inetpub\mailroot\Queue.

Monday, December 3, 2012

Finding Collapsed Groups in DataGrid

This question came up here, which I found when searching a solution to same problem.

Here is some code that solves this issue:

            List<string> grpItems = new List();
            string groupby = "";
            foreach (var control in dataGrid1.GetVisuals().OfType<DataGridRowGroupHeader>())
            {

                var tog = XamlUtils.FindVisualChild<ToggleButton>(control);
                var context = control.DataContext as CollectionViewGroup;
                string nm = context.Name.ToString();
                bool? chk = tog.IsChecked;
                if (chk != null && (bool)chk)
                {
                    grpItems.Add(nm);
                }
                groupby = control.PropertyName;
            }



The methods in XamlUtils are FindVisualChild and GetVisuals which can be found at http://blogs.msdn.com/b/wpfsdk/archive/2007/04/16/how-do-i-programmatically-interact-with-template-generated-elements-part-ii.aspx and http://blogs.msdn.com/b/kmahone/archive/2009/03/29/visualtreehelper.aspx respectively.
Note: To get this to work, for some reason, it required removal of any filters on the PagedCollectionView.