Adding Style Locks Up Visual Studio

Mar 24, 2009 at 6:41 PM
I have a application with some usercontrols that have datagrids in them.  In the App.xaml I added a resource dictionary (using MergeDictionaries) with some very basic styles for some controls (setting margin and opacity).  After adding the dictionary I can't open up a user control xlam file that has a datagrid without Visual Studio locking up.  I need to kill Visual Studio with the task manager.  The only way to open my project agian is to remove the dictionary.  Any ideas what is causing this?
Mar 27, 2009 at 3:46 PM
Edited Mar 27, 2009 at 3:46 PM
I have narrowed it down to one style: 

 <Style TargetType="{x:Type Button}">

     <Setter Property="Margin" Value="1"/>

    <Setter Property="Opacity" Value=".75" />



This style is what locks up the forms that contain datagrids.
Mar 27, 2009 at 9:30 PM
I am not able to repro this. But in general creating an implicit style for Button with Margin is not recommended when you have a DataGrid. The reason is it would affect the SelectAll button of DataGrid and mess up the layout.
Mar 31, 2009 at 9:17 PM
Although the UI was locked up, it appeared to me that the datagrid kept growing in width to infinity causing the lockup of Visual Studio.