wpf

WPF 'magic' negating brush?

Hello! I have a gradient that changes its colors, I want the text inside it should always be visible. I rather doing it dynamically if there is any out-the-box resource; I want a 'magic brush' that negates the color. Any experiments? ...

WPF Lostfocus not firing correctly vs2010 treeviewitem

I have a nested treeview where I bind the doubleclik event on each item so that the text of the node is changed to an editable textbox. I then use the lostFocus eventhandler to remove the textbox and restore the text. void treeViewItemWithMenu_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (selected == e.Sou...

Determine whether selection has been phisically committed by user input (mouse or kb)

How to determine if selection is made programmatically or by user input. I started to write something but since there is more work I decided to seek for some out-the-box procedure or rely on the community experience. So here is what I wrote (Note that answers in C# are welcommed too): Private Shared Function IsUserSelect() As Boolean ...

WPF. How to force listitem to redraw itself?

I have a list box which contains objects describing a person. This objects are only partially filled and are fully filled (time-costly operation) when the item is clicked. I want to alter the style of those objects which have not yet been filled so that partially-filled items are displayed in italics. I made an ItemTemplate <ListBox.It...

WPF Expander - Can't see the internal controls in Visual Studio 2010 Design window

Hi! I'm using Visual Studio 2010 and in a WPF app I'm using an expander. The prob is that the GroupBox etc inside the Expander are hidden from view in the Design window. Any ideas to have them show? Thx! ...

Sorting a combobox purely in XAML

I'm surprised that no one has asked this before here... well, at least I haven't found an answer here or anywhere else, actually. I have a ComboBox that is databound to an ObservableCollection. Everything worked great until the guys wanted the contents sorted. No problem -- I end up changing the simple property out: public Observable...

wpf designer: the type initializer for threw an exception

I'm having an issue with databinding to a service class in WPF. My service class has a static constructor that reads configuration information and pulls in some required information. The problem is that during design, I get the error the type initializer for Mytype threw an exception. I believe this is because the configuration inform...

WPF: Examples of using a Style on a Window.

I have created a borderless window style wherein I draw the chrome (Borders, TitleBar, Min, Max, Close, SystemMenu, etc) and I would like to check it against an existing example. Specifically for the SystemMenu but also in case I missed something. Does anyone have or know of similar examples? ...

Glowing WPF Buttons

After clicking the WPF buttons in our app they glow blue, back to original color, back to blue, etc. This appears to be default behavior on Windows Vista/7. It does not happen on XP. I have searched this site and googled to hell but I can't find how to disable it. Any advice? Thanks Jason ...

WPF datagrid styling

I want to style a WPF datagrid and it seems to be really easy . As far as I understand I have to have code such as the following: <Style x:Key="DataGridColumnHeaderStyle" TargetType="{x:Type Custom:DataGridColumnHeader}" > <Setter Property="Background" Value="#88800080" /> <Setter Property="Foreground" Value="White" /> </Style> ...

SpeedRatio & MediaTimeline

I'm trying to be able to affect SpeedRatio on a MediaElement whilst having the media play in a continous loop. This is possible through code behind; I can reset the position of the media once it has ended, but that creates a seam in the playback. For seamless playback, I use a MediaTimeline, but when I use I media timeline, I can't c...

WPF Memory Leak - Bug In Framework?

Ok, to give a quick rundown of the context of my situation. We have a windows forms tab control, and inside the tab is a element host that contains a wpf usercontrol. When the tab opens, I have a grid that overlays the whole usercontrol to indicate loading. Below is the xaml. I removed some bindings and xaml that aren't relevant. <Grid...

Programatically creating a WPF 3D cube

What is the simplest way to programatically create a GeometryModel3D cube in wpf? ...

WPF: How do I disable the SystemMenu shortcut 'Alt+Space'?

I have a borderless window and created the chrome but I need to disable the 'Alt+Space' shortcut. Any thoughts? ...

Twitterizer API Questions

Hi all, I've recently been playing around with the awesome Twitterizer Twitter API using C# WPF in Visual Studio 2008. It's been working the most part, but I do have some questions about it. 1) How can I make it so that the login screen is a different windows that closes when you log in, unless there is a login failure? 2) How can I ...

Is there any way to access the control templates used by office 2007

In WPF, the default scrollbars are boring light blue controls, however I noticed that Office 2007 has some really nice scrollbars with animated color transitions. Does Microsoft provide these visually pleasing scrollbars in WPF? (Via a template or any other method) ...

WPF UserControl with multiple Children.

I have a UserControl that I would like to be able to have more than one child. It already has StackPanel as it's child, so what am I doing wrong? Ultimately, I'd like for the control to include some of its own children automatically and then, when it's used, allow placing more children inside one of its elements. I tried MSDN's How to...

WPF why is my ScaleTransform Frozen and how can I bind to it?

I have a pretty simple user control that I want to bind a ScaleTransform property to a DP in the code behind like so: <UserControl x:Name="RoundByRound" DataContext="{Binding RelativeSource={RelativeSource Self}}" ... > <Canvas x:Name="MyCanvas"> <Canvas.RenderTransform> <TransformGroup> <ScaleTransform ScaleX="{Binding Zo...

WPF/C#: How does one reference TabItems inside a TabControl?

I'm sure there is something simple that I am missing, but I must confess that at this point I am at a loss. I am programmatically adding TabItems to my main TabControl, one for each account that the user chooses to open. Before creating and adding a new TabItem I would like to check if the user already has the account open in another t...

How to free WPF resources after using

Hi all I used a image as user avatar at the first time my application was loaded. After that, user can change their avatar. But the problem is that after using a new avatar user cannot delete old avatar. The error message show that : "file access denied". That means my application is still using old image somewhere but I don't know. My...