[英]WPF DataGrid Style Change
我有一個自定義DataGrid
的以下XAML:
<Controls:ResourceDataGrid
x:Name="resourceDataGrid"
AutoGenerateColumns="false"
Style="{StaticResource MetroDataGrid}"
ItemsSource="{Binding Path=Resources,
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged,
IsAsync=True}"
...
AttachedCommand:CommandBehavior.Event="CellEditEnding"
AttachedCommand:CommandBehavior.Command="{Binding DynamicColumnTargetChangedCommand}">
...
</Controls:ResourceDataGrid>
我根據MahAppsMetro設計控件的樣式,網格看起來很棒。 但是,當我更改應用程序的'主題'/'重音'時,所有窗口都會改變顏色,所有MahAppsMetro控件也會更改, 但我上面詳述的DataGrid
卻沒有。
該DataGrid
的樣式為MetroDataGrid
,為什么沒有這個控制被更新了,什么我必須做的就是它更新“主題” /“口音”顏色此控制?
謝謝你的時間。
主題僅適用於CustomControl
。 為了為控件提供不同的“皮膚”,您需要具有名為generic.xaml
的XAML文件的CustomControlLibrary
項目。
您可以在Martins 10博客的Themes / generic.xaml頁面中找到簡短的基本描述,或者如果您更喜歡深度,可以在MSDN的控制創作概述頁面中找到完整的描述。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.