I came across a rather strange thing, I have a DataGrid defined on the WPF XMAL page that declared the following:
<DataGrid.Resources> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#FF3399FF" /> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="White" /> <SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="#FF3399FF"/> <SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="White" /> </DataGrid.Resources>
Technically, two types of Inactive SystemColors are taken from .net 4.5, however I can compile the program when it is set to the target .net 4, and these inactive brushes work, but while it is configured to target .net 4 loading the XMAL designer page in Visual Studio gives an error The member "InactiveSelectionHighlightTextBrushKey" is not recognized or is not accessible. , and then blocks the constructor view. But it still compiles and displays as defined above in the program.
This, apparently, is very incompatible, and I canβt say if this is a Visual Studio 2012 problem or if it allows me to compile the program because my development computer has .net 4.5 and it just changes the target structure when it sees that something uses it (I really doubt it). Or is it possible that inactive types are in .net 4 but are not listed as supported in the documentation and just cause this problem in VS?
Is there a better way to do this in .net 4 so that I can set the inactive highlight color in the DataGrid row? Or is this the only way to do this to upgrade to .net 4.5?
siva.k Dec 10 2018-12-12T00: 00Z
source share