wpf

WPF Aero window without shadow

I am aware of the following question: http://stackoverflow.com/questions/3696838/i-want-to-disable-the-shadow-effect-on-a-specific-aero-window However, I still need the DWM blur/reflections behind my Aero window, so I can't create a custom transparent one. How would I approach that? I could handle the reflections by myself, but I don't ...

Simple small INotifyPropertyChanged implementation

Say I have the following class: public MainFormViewModel { public String StatusText {get; set;} } What is the easiest smallest way to get my changes to StatusText to reflect to any controls that bind to it? Obviously I need to use INotifyPropertyChanged, but is there a cool way to do it that does not clutter up my code? need lots...

Calculated Dependency Properties without callback?

In a poco view model I might have a calculated property that pulls data from several different properties inside its get. When these properties values change I need to remember to call OnNotifyPropertyChanged for the calculated property. I was thinking that any line of code where I say NotifyPropertyChanged is not testable code, so I a...

Where is DataGridHeaderBorder for WPF DataGrid?

I found some styles for WPF DataGrid online and all of them are for pre-release DataGrid. Now, I'm using .NET4 DataGrid, I got a compile error complaining DataGridHeaderBorder cannot be found. Based on Microsoft, it is in Microsoft.Windows.Themes namespace. No matter what I try, I can't make it work. ...

Using MVVM how can I find out if a ComboBox has changed the selected value?

I have a view that has 2 combo boxes (Call them ParentTypeCombo and ChildTypeCombo). Both of these combo boxes have the same backing drop down list (call it WorkItemTypes). Using MVVM how can I know when the value was changed for these combo boxes? I have bound them to properties (Call them ParentType and ChildType). But as I recall,...

Very basic DependencyProperty problem in WPF - tyring to bind to a complex object

I'm just getting started with WPF. I have TextBox declared in xmal like so: <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Path=TestComplex.Something, Mode=TwoWay}"/> In my code behind I have registered the property that I am trying to bind to like so: public TestComplexObject TestComplex { get { return (TestComplex...

How to add comment for an attribute definition from within a tag?

Let's say we have the below code: <Window x:Class="Consus.Client.UI.Sandbox.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary" x:Name="Ribbo...

limit item highlight width to grid width

Hi Dear, I am using ListView with GridView as ListView.View. I want to limit the width of the highlight bar to the actual width of the grid, not stretch over the whole window. Should I using the ListView.ItemContainerStyle to customized? Can you tell me how? Thank you very much. Cheers ...

DataGrid - how to make Column sorting dynamic, to cater for when bound data changes?

I'm using a DataGrid in a VS2010 WPF C# project. I have bound the DataGrid to an ObservableCollection. When you click on a column heading it sorts the data at that point in time. Question - How would I arrange such that the sorting in the DataGrid is dynamic, so that when data changes (within the ObservableCollection) the sorting keep...

WPF Programatically scrolling a canvas in a items control

I have an ItemsControl that contains a canvas within a ScrollViewer. The canvas is large and only a portion of it displays at a time. I want to programatically scroll it (the user clicks and drags the canvas to scroll). I looked through the ScrollViewer methods and tried the following in the mouse event handlers: var scrollViewer = (sen...

Mutually exclusive view instances in view first approach in mvvm

Hi, I have asked a question about mvvm view first approach. http://stackoverflow.com/questions/3795737/issue-with-mvvm-view-first-approach But i have seen that shared attribute is only available in version 4.0. Is there any other way to solve it ? ...

The selected item in my listbox is always the previous item

Really having an issue debugging this...the reason why is probably very simple but I'm still an amateur at WPF. It's easier if you see the code but I'll give you the specific problem. My listbox is set to contain a grid format and each listboxitem has a ListBoxItem.PreviewMouseLeftButtonDown event. The problem is, the selected item is a...

WPF DataGrid Styling Triggers

Hi, I am writing a simple WPF application to display log file data. I have successfully databound to my events collection, and used various style triggers to style the grid (different background colours for different event types etc). I now wish to add buttons to show/hide different event types (warning, error, information, etc). I can...

How to display a MessageBox when wrong input is given and reverting the old value of TextBox using MVVM in WPF

I have been using WPF and its built in validation controls for quiet sometime. I was going through an excellent article in codeproject whose link is given below http://www.codeproject.com/KB/WPF/wpfvalidation.aspx I am having a requirement from one of our clients which I have not been able to chieve using MVVM in WPF. The problem is as ...

Bind rectangle fill to a value

<UserControl.Resources> <DataTemplate x:Key="MyCustomTemplate"> <StackPanel Orientation="Horizontal"> <Label Content="{Binding Path=ID}"/> <Rectangle Height="18" Width="20" /> </StackPanel> </DataTemplate> </UserControl.Resources> <Grid> <ListBox x:Name="userListBox" ...

Select root in TreeView before first draw

Hi all. I have a TreeView with binded ItemsSource. I want to select my root(first) node. But ItemContainerGenerator has not generated any TreeViewItem objects yet. Is there any nice way to select the items without using timers/threads and so on ? ...

wpf scrollbar lineDown method

Hi Is there any way to slow down a bit scrolling ? I have a canvas where I put some controls witch I can move. If control reaches current maxWidth of canvas I use method called LineDown to scroll my canvas. However the scrolling is very fast. Is there any way to slow it down a bit ? Maybe I can set some property wich 'tell' scrollviewer ...

How can i get the control inside the item template column of Wpf Datagrid

Hello Experts i have A problem i m new in Wpf i m using Wpf Datagrid i hv one CheckBox Column (item template column) inside this. i m able to find its All Event but how can i get it i want ischeckdproperty true according to my condtion But i m Unable to caught it my xaml code is below <my:DataGrid AlternatingRowBackground="LightBlue...

How can I use a WPF FlowDocument or FixedDocument to compose a printable page from on screen controls?

I'm attempting to print a number of WPF controls (datagrid, charts etc) that are on screen in my application but which need to be re-arranged and supplemented with other text etc. Using the WPF FlowDocument or FixedDocument seems the obvious way to compose and print documents but I'm struggling to achieve this. I've tried creating a Vi...

wpf bind a controlitem to collection

hey there i am having problem i have List<List<memoryCard>> that i want to show in my xmal in a button how can I bind my button to the data i want thos is my usercontrol : < <ControlTemplate x:Key="ButtonControlTemplate1" TargetType="{x:Type Button}"> <Grid> <!--i think this is the place where i make mistake :--> ...