public UsercontrolContacts(ViewModel.Contact item, ResourceManager _rm, string[] _ResourceNames, Pages.Contacts _con) { InitializeComponent(); rm = _rm; con = _con; ListViewItemMenu1.Visibility = item.Name != null ? Visibility.Visible : Visibility.Collapsed; ListViewItemMenu2.Visibility = item.Phone != null ? Visibility.Visible : Visibility.Collapsed; ListViewItemMenu3.Visibility = item.Email != null ? Visibility.Visible : Visibility.Collapsed; ResourceNames = _ResourceNames; this.DataContext = item; LoadFormats(); }
internal void CreateContactList() { WPE = new Models.WeddingPlannerEntities(); contList = WPE.Contacts.Where(x => x.User_Id.Equals(User.IDLogin)).OrderBy(x => x.Con_Name).ToList(); ContactItems.Children.Clear(); foreach (var item in contList) { ViewModel.Contact it = new ViewModel.Contact(item.Con_Name.Trim(), item.Con_Phone.Trim(), item.Con_Email.Trim(), item.Con_ID.ToString()); ContactItems.Children.Add(new UserControls.UsercontrolContacts(it, (rm as ResourceManager), ResourceNames, this)); } if (ContactItems.Children.Count > 0) { BT_ExportToExcel.Visibility = Visibility.Visible; } else { BT_ExportToExcel.Visibility = Visibility.Hidden; } }