wpf-4.0

Combobox background not being applied in windows 8

雨燕双飞 提交于 2019-11-28 12:12:34
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 GradientButtonBackgroundBrush}"/> </Style> The combobox Background property has no effect in windows 8

How to grow/shrink a TextBlock (Font Size) to the available space in WPF?

烂漫一生 提交于 2019-11-28 09:37:06
I've seen this question asked a lot, however, to the opposite of what I'm looking for. While other people want a control to size itself based on the size of text, I'm trying to figure out is if there is a way to grow the size of text to the amount of space available. Take the idea of a digital clock window and you want the numbers stating the time to grow (or shrink) based on the size of the window the clock is in. If there isn't a way to automatically do this any pointers to a programmatic way I can get this accomplished? The WPF Viewbox control will grow / shrink its contents to the

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

僤鯓⒐⒋嵵緔 提交于 2019-11-28 09:26:21
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 DataContext of the UserControl in which there is the ListBox. The above code results in "no target found

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

依然范特西╮ 提交于 2019-11-28 09:17:22
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 performance issues. The only problem is that it seems that every several minutes, the events for

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

时光毁灭记忆、已成空白 提交于 2019-11-28 03:21:25
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 anything about my code/markup. Before (WPF Toolkit DataGrid) After (.NET 4.0 DataGrid) As I learned in an

WPF4 DataGridHeaderBorder in a xaml Style

ⅰ亾dé卋堺 提交于 2019-11-28 02:16:55
Making a separate question, related to comments on the answer to WPF 4: What happened to DataGridColumnHeader? It appears I can use DataGridHeaderBorder in a UserControl, stand-alone in a ResourceDictionary, but not in a Style's setter of a Template. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <!-- Works --> <DataTemplate x:Key="yomama"> <DataGridColumnHeader /> </DataTemplate> <!-- Compile Error: error MC3074: The tag 'DataGridHeaderBorder' does not exist in XML namespace 'http://schemas

Two Pass Layout system in WPF and Silverlight

纵饮孤独 提交于 2019-11-28 01:04:32
问题 Many times I have seen that the code in MeasureOverride and ArrangeOverride is same excepts calling measure and arrange in respective methods and a bit of additional logic like animation etc for each item in ArrangeOverride . Would it not be simple if you just have a method to pass your logic of measuring at one place and layout system remembers that and have an event when each item is about to add and you apply the additional logic of animation etc? Am I missing anything? 回答1: Yep, you are

filter wpf datagrid values from a textbox

夙愿已清 提交于 2019-11-27 21:38:19
I have a textbox and a Datagrid. The datagrid has two columns name and Email address. I want to Filter the datagrid values with the value in the textbox. You can use a ICollectionView for the DataGrid ItemSource then you can apply a Filter predicate and refesh the list when needed. Here is a very quick example. Xaml: <Window x:Class="WpfApplication10.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="188" Width="288" Name="UI" > <StackPanel DataContext="{Binding ElementName=UI}">

Overriding button background in WPF on Aero

雨燕双飞 提交于 2019-11-27 16:40:19
问题 So, the desire is simple, change a button's background to LightGreen, Green when the mouse cursor hovers over it and DarkGreen when it is pressed. The following XAML is my first attempt: <Window x:Class="ButtonMouseOver.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <Button Background="LightGreen"> Hello <Button.Style> <Style TargetType="Button"> <Style

How to convert DataGrid to dataTable

空扰寡人 提交于 2019-11-27 07:43:26
问题 I want to copy all the datagrid records into datatable without using any loop. For Ex: Dim dt as New DataTable dt = Datagrid1.Items But this is not Working and giving an error message. My Development platform is Visual studio 2010 and language is WPF with vb.net 4.0 回答1: This is the way to transfer all the records from DATAGRID to DATATABLE without using the LOOP. VB: Dim dt As New DataTable dt = CType(DataGrid1.ItemsSource, DataView).ToTable C#: DataTable dt = new DataTable(); dt = (