wpf

WPF: Detect Animation or Cancel Timeline.Completed Event? How?

I'm moving 3d camera like this: Point3DAnimation pa; // Triggered by user click void MoveCamera(object sender, EventArgs e) { pa = new Point3DAnimation(myPoint3D, TimeSpan.FromMilliseconds(2000)); pa.Completed += new EventHandler(pa_Completed); Camera.BeginAnimation(PerspectiveCamera.PositionPr...

Use Canvas to mask another canvas in C#/WPF

Hi, I am learning some WPF/C# so this question might be silly for some of you but I can't find the solution. I have a Canvas (let's say it countains texts) and then I have another Canvas that I want to use as a mask (anything in this second Canvas will mask the first one). How can I do that? What if the second Canvas is moving? I want...

Binding to properties of a control in a tooltip

Hi, I want to display some properties of a (custom) Label in its Tooltip, but I can't seem to get it working correctly so must be doing something wrong: <Label.ToolTip> <Border BorderBrush="Gray" CornerRadius="5" Margin="5" Padding="5"> <Label Content="{Binding Path=Width, RelativeSource={RelativeSource Mode=FindAncestor, An...

How do I make an AttachedProperty the target of a MultiBinding?

I've been working with the WPF DataGrid and trying to centralize my cell style. During this refactor, I came across a need for my cell style to know validation logic that is different for each column. I decided to provide an attached property on my column object, which would contain the result of my validation logic (with the logic being...

WPF ComboBox - showing something different when no items are bound

I have a ComboBox, and i want to change its look when the ItemsSource property is null. When it is in that state, i want to show a TextPanel with the text "Retrieving data" in it, and give it a look kind of similar to the watermarked textbox. I figure to do this i need a ControlTemplate, and a trigger. I have the ControlTemplate here: ...

WPF or Silverlight 3 Pixel Shader for Stippling Effect

Can anyone recommend an algorithm for a HLSL Pixel Shader (for WPF or Silverlight 3) to do a stippling effect? Here are some examples: http://www.nolinovak.com/, http://sprouls.com/ ...

Using DataTemplate for infragistics XamComboEditor (WPF)

How can I use data template for infragistics combo box? Basically we want to display multiple columns in a combo box. These columns come from different properties of same object. ...

WPF page layout control selection.

I have an imagebrush of a soccer field as the page background and I want to be able create a line up by dragging players off the bench and positioning them on the field accordingly. I don't know what control to use for the background that allows the PlayerCard control to reside where it is dragged. Any help as to how to begin would be ...

Design Firewall Software

How can I design a Firewall software? The design should have a layered approach. ...

Difference between Visibility.Collapsed and Visibility.Hidden

What are differences between Visibility.Collapsed and Visibility.Hidden in WPF? ...

[WPF] Control focus styling

Hey guys, in above image you would notice that, doted rectangle indicating ComboBox is focused But the problem is it exceeding the text area of ComboBox... how do I align it with text area WPF Style? Thanks ...

What is the relationship between INotifyPropertyChanged and DependencyProperty?

I'm building a simple UserControl example with DependencyProperties so that the properties of the control can be changed in XAML (code below). But of course in my application I don't want this control to have tightly-coupled code-behind, but instead the user control will be a view called "DataTypeWholeNumberView" and it will have its ow...

Wrapping images in ListBox using WrapPanel and ScrollViewer, Selected Items disappear!!

I'm using a ListBox to display a horizontal display of 800 thumbnails, but only 6 at a time (depending on screen resolution), I want to move through the images using buttons either side of the list. I currently have this working, but when I change the SelectedItem of the listbox to next/previous thumbnail the ScrollViewer doesn't autom...

How can a WPF UserControl inherit a WPF UserControl?

The following WPF UserControl called DataTypeWholeNumber which works. Now I want to make a UserControl called DataTypeDateTime and DataTypeEmail, etc. Many of the Dependency Properties will be shared by all these controls and therefore I want to put their common methods into a BaseDataType and have each of these UserControls inherit fr...

Width Adjustment of a Listview

I have a GroupBox inside it a DockPanel and it contain two listviews. There are 2 buttons, On each button click one listview will visible and other will collapse. But the listview will not adjust the width to make it fit inside the groupbox. How can I make the listview fit inside the groupbox? ...

Change header backgraound color for WPF expander

Hi, I am trying to change the expander backgraund color, It seems so easy but I can't do that. <Expander Name="expOneDay"> <Expander.Header> <TextBlock Foreground="CadetBlue" Text="Some Text" HorizontalAlignment="Stretch" /> </Expander.Header> ... </Expander> why HorizontalAlignment="Stretch" doesn't ...

What is the best way to not have DependencyProperties conflict with actual properties?

I find that when I make Dependency Properties, most of them conflict with names of properties in the UserControl, e.g Background, Width, etc. so my strategy is to prefix all of my custom properties with "The" so I have, e.g. TheBackground TheWidth etc. I tried using the "new" keyword which gets rid of the warning, but that leads to ...

How to "Decorate" a control in WPF?

I want that some of the controls in my window will be surrounded by a border and a label above them that will contains a title, which tells something about a control (e.g. a list of persons, surrounded by a border, and above the list there is a label with the text "My Persons"). Since I want apply this on many controls, I don't want to w...

Resize listview in WPF

Hi, How to resize listview when main window is resized? Sorry for editing. Want to set the minwidth for gridviewcolumn. So the listview column is set to the min width when page is resized. Is it possible? Thanks SD </GridViewColumn> ...

EndEdit equivalent in WPF

I have a WPF Window that contains a TextBox. I have implemented a Command that executes on Crtl-S that saves the contents of the window. My problem is that if the textbox is the active control, and I have newly edited text in the textbox, the latest changes in the textbox are not commited. I need to tab out of the textbox to get the chan...