wpf

Binding a datacontext string property to a StaticResource key

I have an List values with a ResourceKey and a Caption, these values are both strings. The Resource is the name of an actual resource defined in a resource dictionary. Each of these ResourceKey Icons are Canvas's. <Data ResourceKey="IconCalendar" Caption="Calendar"/> <Data ResourceKey="IconEmail" Caption="Email"/> I then have a list v...

Using a Storyboard animation on a programatically-added control

I'm trying to fade in a new control to my application's "app" area which is programatically added after the existing controls are removed. My code looks like this: void settingsButton_Clicked(object sender, EventArgs e) { ContentCanvas.Children.Clear(); // Fade in settings panel NameScope.SetNameScope(this, new NameScope())...

Office 2007 and WPF

I've recently been using Excel and Powerpoint 2007, and it's seems clear that the shapes are using WPF. Edit - I know the shapes have existed in Office for ever, that is not my question. Look at the fill possibilites for shapes in 2007, look at that gradient fill, look at its parameters - that's the same as WPF as far I as I can see. S...

WPF: Referencing the Window from a Custom Control

I have followed the Accepted Answer's instructions from this post as regards creating a code behind file for a Resource Dictionary, and it worked...so now I can attach events to controls in the generic.xml file. But now I want to be able to call the DragMove() method from an event in there and since there aren't any references to the wi...

Line Art Effect by Pixel Shader in WPF?

I want to create a Line Art effect but as I got vertex shader is not supported by WPF now. Is there a way to create Line Art effect by Pixel Shader? Any idea? Thanks. ...

how to hide flick pointer in WPF?

I reference this article How to handle window message in WPF? http://stackoverflow.com/questions/624367/how-to-handle-wndproc-messages-in-wpf/624424 And can get a message(WM_TABLET_QUERYSYSTEMGESTURESTATUS) from touch screen. But more than that, I want to return TABLET_DISABLE_TOUCHUI_FORCEOFF | TABLET_DISABLE_FILCKS to hide flick poi...

WPF - Can't stop an animating StoryBoard, IsControllable not working?

I have a 3D cube which I'm animating using a shared storyboard. The animation code is in the selectionChanged event of a combobox and is INTENDED to make sure that any animation that is still running be stopped before the next begins; but it's not working like that! I realize this is some pretty messy code but i still don't see why my ...

WPF Application referencing System.Windows.Forms

Hi, I'm creating my first WPF application and I wanted to understand if there is some kind of best practice when mixing functionality from the System.Windows.Forms namespace. Basically I want to have a popup window that opens by default in the bottom right hand corner of the users monitor. I can't find a Screen.PrimaryScreen.Bounds eq...

WPF Accelerator Keys like Visual Studio

Hello all, I'm developing a large line of business app with C# and WPF. Our standard is to include accelerator keys for buttons on all forms (Save, Cancel, Search, etc.). I've recently noticed that when a form is loaded, the accelerator key is active even when the user does not press the "Alt" key. For example, our Search button uses...

Need help handling events of a DataTemplate in the Application.xaml file.

I have in my application a data template that has a few buttons. I want those buttons' even handler to be fired in the current page (I am using this template in many pages) rather than in the Application.xaml.vb/cs file, since I want different actions on each page. I hope I am clear. ...

Setting Button FlatStyle in WPF

I have just been learning about how styles and control templates in WPF can affect the appearance of buttons, I'm trying to set the Button's FlatStyle, in the resources I've seen I can't find anything that tells me how I can do this, in Windows Forms this is set through FlatStyle = Flat. How would one do this in WPF? ...

Stupid DependencyProperty question

I'm trying to bind the Forderground dependency property to my UIControl, so that it's drawn in the color the user wishes. Since myUiControl.Foderground autocopletes, I thought I could just bin it in the XAML file like this: {Binding ElementName=rootControl, Path=Forderground} When debugging VS says it cannot find the source for binding...

WPF Datagrid Performance

I am working with the WPF Toolkit data grid and it is scrolling extremely slow at the moment. The grid has 84 columns and 805 rows. (Including 3 fixed columns and the header is fixed.) Scrolling both horizontally and vertically is extremely slow. Virtualization is turned on and I have enabled column virtualization and row virtualizati...

Binding to properties of Storyboard declared in UserControl

Hi there, I'm struggling with a binding that only works when declared inside a Window's resources area. As soon as I move the declaration to a UserControl's resources area, the binding fails. No error message, but the value is not updated when the value of the slider (source) is changed. I would like to use the storyboard inside one of ...

Inserting an HTML fragment into a WPF FlowDocument

I'm dynamically building a WPF FlowDocument from a datasource. One of the data elements is a fragment of HTML - I need to figure out a way to parse that and insert it into my FlowDocument. I've found HTMLToXAMLConverter which will return a XAML representation of the HTML, but I'm still not sure how to best go about instantiating that X...

How to expose properties of a WPF DataTemplate?

I have a data template that I use in many pages, the data template contains a few buttons, I want to hide some of these buttons by triggers (I mean setting the IsEnabled Property of these buttons in the page where I use this DataTemplate). In other words, I would even like to set in style triggers/setters a property 'ButtonXIsEnabled', ...

In WPF, how can I add a border to a control in code behind?

In my XAML I want to dynamically generate a ListBox with the following: <ListBox Name="MainListBox"> <Border Style="{DynamicResource ListBoxItemRoundedBorder}"> <ListBoxItem > <TextBlock> Some Text Here </TextBlock> </ListBoxItem> </Border> <Border Style="{DynamicResource ListBoxItemRoundedBor...

Why can't I set the Opacity in this situation?

Here's the situation... at the top level, I have a TabControl. Each page in the TabControl consists of a ListBox: <TabControl> <TabItem Header="item 1"> <ListBox> <ListBoxItem>sub item 1</ListBoxItem> <ListBoxItem>sub item 2</ListBoxItem> <ListBoxItem>sub item 3</ListBoxItem> </Li...

Why is my text cropped?

When i try to add a text block to a border element, i only see part of the text. I rotate the text after adding it to the border and that is causing the problem. Increasing the width of the border fixes this issue. But, my border needs to be only 20 units wide. What am i missing here? <Border Name="BranchBorder" ...

WPF Listbox: Change selected and unfocused style to not be grayed out

I have a really simple WPF ListBox with SelectionMode set to Multiple. <ListBox SelectionMode="Multiple" /> When the ListBox loses focus it's really hard to tell what's been selected because the selection colour changes from blue to a light grey colour. What's the easiest way of changing this behaviour so that it stays blue? I know i...