Dynamic Border configuration in WPF
I am using drag and drop functionality in an application and开发者_运维技巧 I need to change the look of a Grid based on the location of the drag point.
For example, I would like to be able to call something like the following that would change the border to only show the bottom, or the top,etc. This example would be that when there is a drag operation performed over Grid, the top border of the grid would be the only one set to a thickness of 5 and would be black.
private void Grid_DragOver(object sender,DragEventArgs e)
{
Grid grid = (Grid)sender;
Border border = new Border();
border.BorderBrush = Brushes.Black;
border.BorderThickness = new Thickness(0,5,0,0);
border.Child = grid;
}
http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.margin.aspx
Edit: Border color http://msdn.microsoft.com/en-us/library/system.windows.controls.border.borderbrush.aspx
精彩评论