void block_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { DraggableLabel t = sender as DraggableLabel; ActualText.Text = (t).Text; PosX.Text = t.PositionX.ToString(); PosY.Text = t.PositionY.ToString(); SizeX.Text = t.SizeX.ToString(); SizeY.Text = t.SizeY.ToString(); FontName.Text = t.FontName; selected = elements.FindIndex(x => x == t); }
private void Add_Text_Click(object sender, RoutedEventArgs e) { DraggableLabel block = new DraggableLabel(); block.Text = "TEXT"; block.FontName = "Arial"; block.Cursor = Cursors.Hand; block.MouseLeftButtonDown += block_MouseLeftButtonDown; elements.Add(block); selected = elements.Count - 1; UI.Children.Add(block); }