wpf-4.0

AngleGradient in WPF

寵の児 提交于 2019-12-18 07:04:51
问题 As you know, there is a gradient option in PhotoShop named AngleGradient . But, WPF has only LinearGradientBrush and RadialGradientBrush gradients. Have you any idea to how to create an AngleGradient by using XAML ? UPDATE: Samples -by photoshop: 回答1: I wrote a shader for this, compile it and add the .ps file as a resource to your project: // no input texture, the output is completely generated in code sampler2D inputSampler : register(S0); /// <summary>The center of the gradient. </summary>

Combobox background not being applied in windows 8

橙三吉。 提交于 2019-12-17 20:07:21
问题 I am a little confused with wpf themes. I would like to have the wpf screens look the same on Vista, Windows 7 and Windows 8. So I have styled the components accordingly and they don't pose problems except when run on Windows 8. For example I have a combobox and I am changing its default background in xaml like this. <Style TargetType="{x:Type ComboBox}" > <Setter Property="FontStyle" Value="Normal"/> <Setter Property="Height" Value="24" /> <Setter Property="Background" Value="{StaticResource

UI Automation events stop being received after a while monitoring an application and then restart after some time

亡梦爱人 提交于 2019-12-17 18:59:03
问题 We are using Microsoft's UIAutomation framework to develop a client that monitors events of a specific application and responds to them in different ways. We've started with the managed version of the framework, but due to delay issues, moved to the native version wrapped in UIACOMWrapper. After more issues with performance inside our (massive) WPF application, we decided to move it to a separate terminal application (transfer the events to our WPF app through UDP) which seemed to fix all the

“No target found for method” thrown by Caliburn Message.Attach()

て烟熏妆下的殇ゞ 提交于 2019-12-17 18:58:11
问题 I have a list box for which I am styling ItemContainer to include a context menu. Here is the xaml for the same. <ListBox.ItemContainerStyle> <Style TargetType="{x:Type ListBoxItem}"> ... <Setter Property="ContextMenu"> <Setter.Value> <ContextMenu> <MenuItem Header="Remove Group" cal:Message.Attach="DeleteGroup"/> </ContextMenu> </Setter.Value> </Setter> </Style> I have coded the target method in ViewModel as given below. public void DeleteGroup() { //ToDo ... } The ViewModel is set as the

Why can't I style a control with the Aero theme applied in WPF 4.0?

拟墨画扇 提交于 2019-12-17 17:27:08
问题 I recently converted a project from WPF 3.5 to WPF 4.0. Functionally, everything works, but the DataGrid style I was applying on top of the Aero theme has suddenly stopped working. As you can see from the before/after pictures below, my DataGrids went from having an Aero look plus bold headings, extra padding, and alternating row formats to just looking plain "Aero". Besides removing all references to the WPF Toolkit (since the DataGrid is now native to WPF 4.0), I really didn't change

WPF Style DataGridHyperlinkColumn

試著忘記壹切 提交于 2019-12-12 20:23:07
问题 I created a style for a hyperlink control: <Style x:Key="MyHyperlink" TargetType="{x:Type Hyperlink}"> <Setter Property="Foreground" Value="{StaticResource HyperlinkBrush}" /> <Setter Property="IsEnabled" Value="{Binding IsEnabled,RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}}" /> <Style.Triggers> <Trigger Property="IsEnabled" Value="True"> <Setter Property="Cursor" Value="Hand"/> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Foreground"

ScrollViewer and TextBlock wrapping

限于喜欢 提交于 2019-12-12 14:46:23
问题 I have the following layout (simplified): <Grid> <Grid.ColumnDefinitions> <ColumnDefinition MaxWidth="400" /> <ColumnDefinition /> </Grid.ColumnDefinitions> <!-- Code for Column=0 --> <ScrollViewer Grid.Column="1"> <Grid x:Name="layoutGrid"> <Grid.ColumnDefinitions> <Grid.ColumnDefinition Width="Auto" /> <Grid.ColumnDefinition MinWidth="100" MaxWidth="400" /> <Grid.ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition />

WPF dataGrid super Header for multiple columns

被刻印的时光 ゝ 提交于 2019-12-12 12:08:46
问题 I want to do Header for multiple columns in WPF DataGrid . I tried with Header template but it will display Header for one column. Below XAML I have tried: <DataGrid> <DataGrid.Columns> <DataGridTextColumn> <DataGridTextColumn.HeaderTemplate> <DataTemplate> <StackPanel> <TextBlock>Column 1</TextBlock> <TextBlock>xyz</TextBlock> </StackPanel> </DataTemplate> </DataGridTextColumn.HeaderTemplate> </DataGridTextColumn> <DataGridTextColumn Header="Header" /> </DataGrid.Columns> </DataGrid> I am

Why does UseLayoutRounding not seem to work with Viewbox?

人走茶凉 提交于 2019-12-12 04:39:10
问题 I'm trying to write a tile-based game in WPF 4. I want the game board to scale to fit the window, so I'm using a Viewbox; but I want each tile to be on a nice, crisp pixel boundary. I might be wrong, but my understanding is that this is what the new UseLayoutRounding property is supposed to be for -- but it isn't working the way I expect. Here's a window that demonstrates the issue: <Window x:Class="Tyler.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http

Change old WPF ProgressBar controltemplate to WPF4

余生长醉 提交于 2019-12-11 14:48:08
问题 I want a thermometer in my WPF app and found a template in MSDN magazine Edit start I have found the reason why it doesn't work: http://connect.microsoft.com/VisualStudio/feedback/details/571674/issue-with-vertical-progress-bar-on-4-0-framework But I/you? still have to figure out how to make it work with WPF4. Edit end The control looks fine, but it doesn't seem to update the indicator when setting Value. I've pasted it into Kaxaml and also tried VS2010. Is the code buggy or am I doing