wpf

Data binding custom control with parent

I have a UserControl that contains a listbox. On the parent window, I have this UserControl and a button. Ideally I'd like to use the ChangePropertyAction behavior on the parents button, and tie it to the UserControl's listbox count. The idea being that if there are no entries in the listbox inside the usercontrol, the button on th...

Programmatically Replacing Last Child in a WPF DockPanel with LastChildFill true

When LastChildFill property of a DockPanel is set true, the last child added occupies the entire unused space. That works well, until I had to programmatically replace the last Child: UIElementCollection children = myDockPanel.Children; UIElement uie = new myBestControl(); children.RemoveAt(children.Count - 1); ...

Why does UseLayoutRounding not seem to work with Viewbox?

I'm trying to write a tile-based game in WPF 4. I want the game board to scale to fit the window, so I'm using a Viewbox; but I want each tile to be on a nice, crisp pixel boundary. I might be wrong, but my understanding is that this is what the new UseLayoutRounding property is supposed to be for -- but it isn't working the way I expect...

Referencing a base types control template in xaml

I have a control derived from ComboBox, i want to use the ComboBox ControlTemplate, and just set a few values on it in xaml, namely the ItemContainerStyle. The code below doesnt work, the last setter, which im intending to apply the base ComboBox control template to this one, doesnt do anything. <Style TargetType="{x:Type local...

Using enum as a dependency property in WPF

I try to use enum type as a dependency property in my custom control, but always get an error: public enum PriceCategories { First = 1, Second = 2, Third = 3, Fourth = 4, Fifth = 5, Sixth = 6 } public static readonly DependencyProperty PriceCatProperty = DependencyProperty.Regi...

Attach commands to TreeView in wpf using prism

Hi how do i use a delegatecommand in a treeview to get the expanded event Should i be using the delegatecommnd or is there another way. thanks ...

Saving a screenshot of a window using C#, WPF, and DWM

This is a follow up question to this question The solution to the above uses DWM to display a thumbnail of an active window. If I understand correctly, it works by letting you specify the window handle of the application you want to view and then having you provide a window handle and a location on that window where windows should draw ...

WPF XAML Intellisense doesn't work correctly for custom routed event handlers

I defined a custom routed event with the following constructs (names changed): public class MyRoutedEventArgs : RoutedEventArgs {...} public delegate void MyRoutedEventHandler(Object sender, MyRoutedEventArgs args); public static readonly RoutedEvent MyEvent; MyClass.MyEvent = EventManager.RegisterRoutedEvent("MyE...

How to design custom Progressbar like MSCUI.NET?

How to design a progressbar like MSCUI Patient Journey Demonstrator? In the Image2 the rectangles inside the progressbar will dynmically increase its size and count based the panels added to the controls. Pls refer MSCUI.Net and take look at the demo PAtient Journey demonstrator. Any kind of help is greatly Appreciated. Image Path (ref...

wpf app on dvd how to?

Just wondering if it is possible to play a wpf app on dvd. We have an app which acts as a Knowledgebase for a few applications. Our client would like the users to take home the dvd and play it to get familiar with various aspects of apps using the dvd. You can kind of think of the KB application as a collection of articles built using w...

Full screen on many screen (WPF)

Hi all, I'm using WPF I would like that my windows take the entire screen of all the screen. If I use the code snippet : WindowState = WindowState.Normal; WindowStyle = WindowStyle.None; Topmost = true; WindowState = WindowState.Maximized; it takes only the active screen. How to fill all the screen ? thanks for your help ...

CheckBoxEdit into WPF grid (DevExp)

Hello i put TextBox Column into WPF grid like this: DevExpress.Wpf.Grid.GridColumn col = new GridColumn(); col.FieldName = dr["FieldName"].ToString(); col.Header = dr["Caption"].ToString(); //Gets or sets the name of the column col.Name = "c"+ dr["FieldID"].ToString(); Grid.Columns.Add(col); Does anyone knows how to add a CheckBox t...

What's the best way to avoid memory leaks in WPF PRISM/MVVM application

I have a WPF application based on PRISM that utilizes the MVVM pattern. I have noticed that occasionally my view models, views and everything connected to them will hang around long after their intended lifespan. One leak involved subscribing to CollectionChanged on a collection belonging to an injected service, another involved not ca...

Load Word Excel into WPF

I would like to load a Word or Excel document into a window of a WPF application so that users can view or edit the document within the application. Is there any way to achieve that? ...

C#/WPF: PropertyChanged for all Properties in ViewModel?

Hello, I've a class like this: public class PersonViewModel : ViewModelBase //Here is the INotifyPropertyChanged Stuff { public PersonViewModel(Person person) { PersonEntity = person; } public Person PersonEntity { get { return PersonEntity.Name; } private set { PersonEntity.Name = value; Raise...

How to make ContentControl listen to non-routed event inside its ContentTemplate

I have some reusable ContentControl, which acts as a pseudo-modal popup inside another view. It is always there and only its visibility makes it appear or disappear. When instantiated, within the ContentControl there will be a custom ContentTemplate, bound to some ViewModel and representing the content of the "modal popup". <Dialogs:Mod...

WPF control design guidance - timeline

I'm working on a control for one of our apps. The control shows the currently focused day as a gird, the X-axis being time of day. The Y axis doesn't have a scale as such, rather it will separate out the items to be displayed. The overall look of the control will be quite similar to a gantt chart, showing the times of day of various t...

Command Binding to Usercontrol Drag/Drop.

How to respond to Drag/Drop events of a usercontrol by usinng the commands pattern? ...

Wrapping a control in a border using styles without overwriting default appearance

What I'm attempting to do is wrap a control in a border without changing it's default appearance, and also without having to create custom controls. I'd like to do the equivalent of this: <Border BorderBrush="Red" BorderThickness="3"> <Button>Hello!</Button> </Border> Just to any control, without actually having to wrap everything ...

WPF: How to create custom preview routed event?

I mean the following: I have a custom control which has StateChangedEvent: public class WindowControl : ContentControl { public static readonly RoutedEvent StateChangedEvent; static WindowControl() { WindowControl.StateChangedEvent = EventManager.RegisterRoutedEvent("StateChanged", RoutingStrategy.Bubble, typeof(RoutedEventHandler), ty...