wpf

WPF TreeViewItem Expanding Animation

I used the code from question Wpf treeview - i want to animate the expansion of the nodes, but the animation doesn't work on the first expand, it does work for the consequent expand events. any ideas? ...

Navigation menu for a standalone WPF application

Im just starting out with wpf (in blend 4) and i would like to create an application that has a side menu for changing the content. What i am looking for is something like in word 2010 under the file menu. if you click the menu on the left side the content on the right side changes accordingly. i have read articles about nesting a page.x...

How can I use SnapToDevicePixels and StrokeDashArray

Hello, I have the following XAML code: <Path Data="M0,0 L 12 0 L 12 12 L 0 12 Z M 6 0 L 6 12 M 0 6 L 12 6" StrokeDashArray="1 1" Stroke="Black" StrokeThickness="1" SnapsToDevicePixels='True"> </Path> However it looks horribly fuzzy on my screen. Is there a solution? ...

What good resources are available for an experienced ASP.NET developer to learn Windows Forms/WPF programming?

I am a ten-year veteran of ASP.NET and C# development and I'm moving into a position where I will be doing much more Windows Forms and WPF development. I have minimal experience with these technologies. Can you recommend any good books or resources that will help me ramp up on these technologies quickly? I'd like to find resources that...

Custom Message Box Advice

Hey all Well I'm using a Window as my custom message box with a couple of controls which are displayed/populated with text depending on which constructor is called. I have a defined event, which is subscribed to via the original class, this fires once the button has been clicked. However I can't see how to use this effectively, prefer...

Where to create parametrized ViewModel?

I have recently parametrized my ViewModel's contructor. Before that, I was doing this in my window: <Window.DataContext> <vm:MyViewModel /> </Window.DataContext> The framework instantiated the ViewModel for me. I know I can set DataContext in code but I would prefer a XAML way so designer can display my test data when designing. ...

Display multiple types from a single list in a WPF ListBox?

I'm relatively new to WPF, and it looks like there are probably a bunch of ways to do this, but I can't get any of the ones I have tried to work. I have an ObservableCollection that contains two different types. I want to bind this list to a ListBox and display different DataTemplates for each type encountered. I can't figure out how ...

Styling Hyperlink inside a TextBlock

One of the columns in my DataGrid contains a Hyperlink in a TextBlock. When a row is selected, the hyperlink shows as blue on blue, so i want to change it's text color to white. How can I do that? The DataGrid looks like this: <DataGrid> <DataGrid.Columns> <DataGridTemplateColumn Header="Title"> <DataGridTemplat...

Control.FromHandle for WPF

Is there something like: Control.FromHandle(IntPtr) For WPF. This method is available for WinForms, so I'm just wondering if WPF has it too. Thanks! ...

Should I be using AdornerLayer to avoid clipping my adorner off-screen?

I'm writing some WPF code involving Adorners. I'm using Josh Smith's UIElementAdorner.cs (found in the project on his Infragistics Blog). I'm adorning with a blurb of information text. I need to place my adorner smartly, so that it does not clip off the screen. What's the best way to find out if I'm going to clip? I'm using the ...

Access the ressource of the View from the viewmodel WPF MVVM

I have a View with a DataTemplate <UserControl.Resources> <DataTemplate x:Key="TrackChangeTemplate"> <TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content}" /> </DataTemplate> </UserControl.Resources> and i want in the View : SimpleLink link = new SimpleLink(...

WPF: DataGrid Find and Replace

I'm using a DataGrid to display the values of specific properties of a collection of objects. I've implemented search and cell highlighting through a similar method to the one on Tomer Shamam's blog. However, I now need to implement 'Find/Replace' type functionality. I presumed I would be able to iterate through the DataGrid's cells to ...

How can I specify a default property to bind to in Silverlight / WPF?

Is there a way to specify a default property to be referenced by the Path with data binding within XAML? I am looking to be able to do something like what CollectionViewSource does when using Binding. When you bind to a CollectionViewSource within XAML, it is automatically hooking up Path to the View property. Eg: {Binding Source={Sta...

Measuring controls created at runtime in WPF

Hi, I recognise this is a popular question but I couldn't find anything that answered it exactly, but I apologise if I've missed something in my searches. I'm trying to create and then measure a control at runtime using the following code (the measurements will then be used to marquee-style scroll the controls - each control is a differ...

TextDecorations not being applied to TextBlock during a TreeViewItem Style Trigger

Hi, I have a WPF application in which I would like to decorate logically deleted items (held in a TreeView) by displaying them with the Strikethrough TextDecoration. I can get the style trigger to successfully apply a Foreground color when fired, but when I try to set the TextDecorations it has no effect. Here is some sample code that...

How to selectively update a model in wpf

I have a list of models displayed in a listview when the listviewitem is clicked I open a dialog that is bound to the listviewitem's data model and allows the user to edit the various properties. I am trying to figure how to deal with the ok and cancel buttons. On the one hand if I bind the dialog directly to the listviewitem's model t...

Toolbar placement in toolbartray wpf

hello, i have a problem here, i want to make a multiple toolbar which works just like the toolbar in visual studio. currently i'm doing it like this <ToolbarTray> <Toolbar> <Button x:Name="A"/> <Button x:Name="B"/> <Button x:Name="C"/> </Toolbar> <Toolbar> <Button x:Name="D"/> <Button x:Name="E"/...

C# WPF Program crashing when opened by a different Windows user

Hi, I've created an application that loads data in from XML files locally, and with these files it finds images, videos, and EXE's that the player can run from dynamically created buttons. When loading files and images and running EXE's, I try/catch all over the place as to not crash. However, today a user crashed the program by trying...

How to identify whether the control is going inside the window / tab control bounds in WPF

I want make the control height as double when the mouse is over that control and control height should become normal when the mouse leaves the control. Consider, I am using the following style to make the button height as double when the mouse is over a button. <Style TargetType="{x:Type Buttons}"> <Style.Triggers> <Trigger Pro...

Removing codebehind files from WPF MVVM projects

Hi, I am coding a WPF application using MVVM pattern. I don't need to have codebehind files for my user controls. What is the best way to remove these files elegantly? I can create a user control class then I can use this class for my all views. (for more info: http://sondreb.com/blog/post/No-Code-Behind-for-MVVM.aspx) Are there any a...