我试图在运行时更改突出显示的(选定的)颜色和wpf列表框的突出显示的文本颜色.我尝试过创建一个样式并应用如下:
Style s = new Style(typeof(ListBox));
s.Resources.Add(SystemColors.HighlightBrushKey, Setting.ListSelectedColor);
s.Resources.Add(SystemColors.HighlightTextBrushKey, Setting.ListSelectedTextColor);
lstGames.Style = s;
Run Code Online (Sandbox Code Playgroud)
但这似乎什么都不做.有没有办法实现这个目标?
编辑:
根据建议,我尝试使用DynamicResources来实现这一目标,但到目前为止,这还没有成功.我的代码:
DYNAMICRESOURCES
<UserControl.Resources>
<Color x:Key="ListTextSelectedColor"/>
<Color x:Key="ListSelectedColor"/>
</UserControl.Resources>
Run Code Online (Sandbox Code Playgroud)
列表框
<ListBox ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden"
Name="lstGames" Margin="20" Grid.Row="2" Grid.Column="2"
SelectionChanged="lstGames_SelectionChanged" Grid.RowSpan="2" Grid.ColumnSpan="2"
Background="{x:Null}" BorderBrush="{x:Null}" SelectionMode="Single"
FontSize="18" FontFamily="OCR A Extended">
<Style TargetType="ListBox">
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{DynamicResource ListSelectedColor}"/>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="{DynamicResource ListSelectedColor}"/>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="{DynamicResource ListTextSelectedColor}"/>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="{DynamicResource ListTextSelectedColor}"/>
</Style.Resources>
</Style>
</ListBox>
Run Code Online (Sandbox Code Playgroud)
在C#中应用资源
this.Resources["ListSelectedColor"] = SETING.ListSelectedColor.Color;
this.Resources["ListTextSelectedColor"] = SETTING.ListSelectedTextColor.Color;
Run Code Online (Sandbox Code Playgroud) 当使用xslt文件使用wix转换热量收集组件时,是否可以仅包含某些文件扩展名?我知道我可以使用以下内容排除文件扩展名:
<xsl:key name="exe-search" match="wix:Component[contains(wix:File/@Source, '.pdb')]" use="@Id" /> <!--.pdb-->
Run Code Online (Sandbox Code Playgroud)
但是可以包含多种文件类型并排除其他所有内容(例如:.exe,.dll,.xml)吗?
谢谢!
我有一个引导程序,我想将其内容安装到正在运行引导程序 .exe 的同一目录中。然后当用户按下“LAUNCH”按钮时,将运行该可执行文件。我如何引用这个目录?
我试图通过 MsiProperty 将 $(sys.CURRENTDIR) 传递给 MSI,但查看日志文件,CURRENTDIRECTORY 和 INSTALLFOLDER 不匹配。
CURRENTDIRECTORY=C:\Users\nickd\Desktop\WixTestingInstall\CW6 INSTALLFOLDER=C:\VB6\CW6\CW6.root\CW6\PreReqsInstaller\
我将不胜感激任何帮助。
wix ×2
bootstrapper ×1
c# ×1
directory ×1
heat ×1
installation ×1
installer ×1
listbox ×1
variables ×1
wpf ×1