小编Dav*_*eck的帖子

XAML:使用VS主题颜色制作TreeViewItem

我正在创建一个带有工具窗口的Visual Studio扩展.我在那里使用TreeView.我希望此树视图使用当前的Visual Studio主题.感谢帖子你如何突出显示TreeViewItem?我能够设置文本和突出显示颜色.但还有更多问题:

  • 颜色只更新(重新)视觉工作室的开始,但不是直接更改主题时
  • 如何更改不专心的高光颜色?
  • 如何将可扩展图标颜色更改为当前主题颜色?
  • 在解决方案资源管理器窗口中,是否有机会完成突出显示?

这是我目前的XAML代码:

<UserControl x:Class="DavidSpeck.CSharpDocOutline.DocOutlineView"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:shell="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.12.0"
         Background="{DynamicResource VsBrush.Window}"
         Foreground="{DynamicResource VsBrush.WindowText}"
         mc:Ignorable="d"
         d:DesignHeight="300" d:DesignWidth="300"
         Name="MyToolWindow">
<UserControl.Resources>
    <Style x:Key="CETreeViewItem" TargetType="{x:Type TreeViewItem}">
        <Style.Resources>
            <SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="{DynamicResource {x:Static shell:VsColors.ToolWindowTextKey}}" />
            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{DynamicResource {x:Static shell:VsColors.HighlightKey}}" />
            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="{DynamicResource {x:Static shell:VsColors.HighlightTextKey}}" />
        </Style.Resources>
    </Style>
</UserControl.Resources>
<Grid>
    <StackPanel Orientation="Vertical">
        <TreeView Name="outlineTreeView" 
                  Background="{DynamicResource VsBrush.Window}"
                  BorderThickness="0"
                  ItemContainerStyle="{StaticResource CETreeViewItem}">
        </TreeView>
    </StackPanel>
</Grid>
Run Code Online (Sandbox Code Playgroud)

wpf treeview xaml colors visual-studio-2013

5
推荐指数
0
解决办法
456
查看次数

使用 Visual Studio C++ 进行单元测试时出现链接器错误

我想用 Visual Studio 对我的 C++ 项目进行单元测试。将项目中的文件夹添加为测试项目的包含路径后,尝试编译测试时出现链接器错误:

Severity    Code    Description Project File    Line    Suppression State
Error   LNK2019 unresolved external symbol "public: __thiscall Piece::Piece(enum Color)" (??0Piece@@QAE@W4Color@@@Z) referenced in function "public: __thiscall Bishop::Bishop(enum Color)" (??0Bishop@@QAE@W4Color@@@Z)    ChessPlusPlus-Tests D:\Documents\Projects\ChessPlusPlus\ChessPlusPlus-Tests\BishopTests.obj 1   
Error   LNK2019 unresolved external symbol "public: __thiscall Board::~Board(void)" (??1Board@@QAE@XZ) referenced in function "public: void __thiscall ChessPlusPlusTests::BishopTests::ValidMovesTest(void)" (?ValidMovesTest@BishopTests@ChessPlusPlusTests@@QAEXXZ)  ChessPlusPlus-Tests D:\Documents\Projects\ChessPlusPlus\ChessPlusPlus-Tests\BishopTests.obj 1   
Error   LNK2019 unresolved external symbol "public: void __thiscall Board::placePieceAt(class Piece * const,struct Position)" (?placePieceAt@Board@@QAEXQAVPiece@@UPosition@@@Z) referenced in function "public: void __thiscall ChessPlusPlusTests::BishopTests::ValidMovesTest(void)" (?ValidMovesTest@BishopTests@ChessPlusPlusTests@@QAEXXZ)    ChessPlusPlus-Tests D:\Documents\Projects\ChessPlusPlus\ChessPlusPlus-Tests\BishopTests.obj 1 …
Run Code Online (Sandbox Code Playgroud)

c++ unit-testing linker-errors visual-studio

4
推荐指数
1
解决办法
4750
查看次数