private void Refresh() { itemList.Children.Clear(); if (dataBaseInit) { List <DataBaseItem> list = DataBase.GetAll(); for (int i = 0; i < list.Count; i++) { dataViewItem item = new dataViewItem(); item.firstName.Text = list[i].firstName; item.secondName.Text = list[i].secondName; item.lastName.Text = list[i].lastName; item.phone.Text = list[i].phone; //item.email.Text = list[i].email; //item.address.Text = list[i].street; item.Tag = list[i]; item.MouseDown += ItemMouseDown; item.MouseEnter += ItemMouseEnter; item.MouseLeave += ItemMouseLeave; itemList.Children.Add(item); } } }
private void ItemMouseEnter(object sender, MouseEventArgs e) { dataViewItem item = (dataViewItem)sender; item.BeginAnimation(Rectangle.HeightProperty, null); DoubleAnimation animation = new DoubleAnimation(item.ActualHeight, 67, TimeSpan.FromSeconds(0.2f)); item.BeginAnimation(Rectangle.HeightProperty, animation); }
private void ItemMouseDown(object sender, MouseButtonEventArgs e) { dataViewItem item = (dataViewItem)sender; if (item != null) { foreach (dataViewItem unselectItem in itemList.Children) { if (unselectItem.selected) { unselectItem.Select(false); } double w = itemDataPanel.ActualWidth; itemDataPanel.BeginAnimation(Rectangle.WidthProperty, null); DoubleAnimation animation = new DoubleAnimation(0, w, TimeSpan.FromSeconds(1.0f)); itemDataPanel.BeginAnimation(Rectangle.WidthProperty, animation); } item.Select(true); //Show data } }