Tag: styles

ExcelWriter.Style CellLocked – 为什么它不起作用?

我正在尝试使用#officewriter #excelwriter创建一个简单的示例,并且无法使用这些样式。 不知道为什么。 ExcelApplication XLAPP = new ExcelApplication(); Workbook WB = XLAPP.Create(); Worksheet WKST = WB.Worksheets[0]; DataSet ds = DataView dv = ds.Tables[0].DefaultView; DataImportProperties props = WB.CreateDataImportProperties(); SoftArtisans.OfficeWriter.ExcelWriter.Style dataStyle = WB.CreateStyle(); props.UseColumnNames = true; dataStyle.BackgroundColor = Color.SystemColor.Red; dataStyle.CellLocked = true; Area importArea = WKST.ImportData(dv, WKST.Cells[0, 0],props); importArea.ApplyStyle(dataStyle); XLAPP.Save(WB, Page.Response, “Output.xls”, false); 这是问题所在:颜色样式在输出中起作用,但CellLocked样式不起作用。 为什么? 谢谢你的帮助。 沮丧 […]

在Windows Phone通用应用程序中更改内容对话框按钮的样式

我在我的xaml中定义了这个内容对话框: 而我这样称呼它: private void AppBarButton_Click(object sender, RoutedEventArgs e) { MessageBox(); } private async void MessageBox() { ContentDialogResult LogoutDialog = await AlertMessage.ShowAsync(); if (LogoutDialog == ContentDialogResult.Primary) { this.Frame.Navigate(typeof(MainPage)); } else { // User pressed Cancel or the back arrow. // Terms of use were not accepted. } } 问题:我的应用程序是否具有我的应用程序中所有按钮的样式。 我想将相同的样式应用于该对话框的主要和次要按钮。 我无法弄清楚如何实现这一目标。 是否可以将样式应用于这些按钮?

合并资源字典

我正在尝试将wpf资源字典合并到后面的代码上,但是由于某些原因,这不起作用。 如果我尝试合并文档本身的字典,它正在运行,例如: 这是有效的,但如果我评论ResourceDictionary.MergedDictionaries并在代码中尝试这样: ResourceDictionary skin = new ResourceDictionary(); skin.Source = styleLocation; ResourceDictionary skinFather = new ResourceDictionary(); skinFather.MergedDictionaries.Add(skin); skinFather.Source = styleLocationFather; 这会因为无法找到资源而中断。

使用图像+文本设置WPF按钮的样式

在我的C#/ WPF / .NET 4.5应用程序中,我有按钮,其中包含以下列方式实现的图像: save 我有一个资源字典UIStyles.xaml ,其中我声明了以下内容: 光标,高度,边框等属性工作正常,但我无法设置TextBlock和Image样式。 具体来说,需要看起来像这样: 结束看起来像这样(忽略色差): 我之前看到过类似的问题 ,但是解决方案使用了不同的方法(我不想创建自定义用户控件,除了这个之外,我的所有需求都包含在当前代码中,重写将是一件麻烦事)。 我只需要修复我的Style ,使TextBlock居中, Image居中并缩小。 如何重新编写Style以更正按钮的外观?

在样式的代码背后的BasedOn =“{StaticResource {x:Type TextBox}}”

如何在代码中设置以下内容? 我正在使用App.xaml中合并的主题。 它适用于所有控件,但是当我为某些东西定义样式时,例如TextBox ,除非我像上面一样使用BasedOn ,否则主题样式不会被拾取,而是获得默认的TextBox样式。 现在我在代码后面创建一个DataGridTextColumn ,我无法让BasedOn部分用于EditingElementStyle Style editingStyle = new Style(typeof(TextBox)); editingStyle.BasedOn = …?; 有什么建议? 此外,有没有办法获得主题样式而不是使用默认样式而不使用BasedOn? 谢谢

Style.Triggers与ControlTemplate.Triggers

我应该何时选择Style.Triggers ,何时应该选择ControlTemplate.Triggers ? 使用一个在另一个上有什么好处吗? 假设我有这些样式可以达到相同的效果: … … …

SyleProblem:无法更改BackGround Of特定按钮?

我有一个==> UserControl 。 在UserControl里面==> One ItemsControl 。 现在ItemsControl根据ItemsSource生成Button’s 。 我为这些按钮提供了一些风格。 ==>按钮在Pages.xaml 。 ==>和DataPagerResourceDictionary.xaml Style。 我在Maindwindow.xaml使用了UserControl 。 但我无法根据Button的内容更改特定按钮的Background 。 您可以从 此处 下载完整代码 。 如果我没有为按钮提供样式,下面的代码工作正常。 for (int i = 0; i < displayPages.pageControl.Items.Count; i++) { var container = displayPages.pageControl.ItemContainerGenerator.ContainerFromIndex(i) as ContentPresenter; var button = container.ContentTemplate.FindName("pageNumberButton", container) as Button; if (button.Content == " 3 ") { button.Background = […]

如何更改UWP的复选框背景?

我无法使用以下代码更改复选框的背景,但它适用于Windowsapp store应用(Windows 8.1)。 我想知道如何让它适用于UWP? this.checkBox.Background = new SolidColorBrush(Windows.UI.Colors.Yellow); this.checkBox.Foreground = new SolidColorBrush(Windows.UI.Colors.Blue);

将自定义依赖项属性绑定到自定义WPF样式

设计inheritance的Expander时遇到问题。 我的目的是在切换按钮和默认Expander标头中的文本后面有一个进度条。 我有这个XAML代码,它给我标题中的进度条。 这是一种定制风格。 这工作正常但我无法绑定控制进度百分比的自定义依赖项属性。 public class ProgressExpander : Expander { static ProgressExpander() { DefaultStyleKeyProperty.OverrideMetadata(typeof(ProgressExpander), new FrameworkPropertyMetadata(typeof(ProgressExpander))); } public int Progress { get { return (int)GetValue(ProgressProperty); } set { SetValue(ProgressProperty, value); } } // Using a DependencyProperty as the backing store for Progress. This enables animation, styling, binding, etc… public static readonly DependencyProperty ProgressProperty = […]

我应该*总是*支持在C#3.0中隐含类型的局部变量吗?

Resharper当然这么认为,开箱即用它会唠叨你转换 Dooberry dooberry = new Dooberry(); 至 var dooberry = new Dooberry(); 这真的被认为是最好的风格吗?