wpf

Should my ViewModel contain a URI or a string?

This is somewhat of a followup to my previous question, where people pointed me in the direction of MVVM. I'm trying to understand exactly where the work is supposed to go in this framework. My view contains a textbox into which the user is meant to input a URI. As far as I see, I have two choices: Bind to a Uri object in my ViewMode...

Injecting dependencies into WPF using Ninject

I have a WPF UserControl that I'd like to inject dependencies into. What's the best way to do this with Ninject? To take a concrete example: I have a UserControl called MapView, and I want to inject an instance of my IDialogueService into it, via either constructor or property injection. Currently, I'm not using any dependency injection...

WPF listbox item not wordwrapping

My list box has, amongst other things a description field in it which can be quite long. Instead of having a horizontal scroll bar I want to word wrap it. It works if I set the MaxWidth but since the ListBox changes size I don't want to hard code the value. What's the best way to do this? EDIT: The description is in a TextBlock. Simpl...

Best charting tool for silverlight and wpf

I came across the following till now visifire Teechart Silverlight toolkit chart Dundas has anyone worked on a charting project in silverlight/wpf !! which charting tool would you recommend ? I want to make a wrapper around charts for historical/real time data . Want the chart to have a datamodel which can be extended easily . ...

WPF UserControl naming convention question

Hi. I'm creating a WPF UserControl with many elements inside. I need to work with them and I need to give them names. I've seen that in some custom controls people are naming elements this way: PART_name Should I name my elements like PART_ListBox.. etc? Or what's the purpose of this? Is it to differentiate that these names are part ...

Streaming Audio/Video in WPF with early versions of WMP?

Hey guys I am developing a Wpf App for a large client base, and have just found out that Windows Media Player 10+ is required in order to properly use the MediaElement XAML class in my Form. I personally don't use WMP, so I did not have it updated in my system (it was version 9, so no video played). I know for a fact many of the clien...

WPF - Databind to a StackPanel using DataTemplates

I've modified my question since it has changed focus when trying things out. I narrowed the problem down to the following... I try to bind the selected Item of a TreeView to a StackPanel (or some other container that can hold User Controls). This container will then display a UserControl, depending on the type of the selected item. Her...

Looking for Prism example of Modules loading themselves into a menu

Does anyone know of WPF code examples using Prism in which modules each register themselves as a menuitem in a menu within another module? (I've currently got an application which tries to do this with the EventAggregator, so one module listens for published events from other modules which need to have their title in the menu as a menu ...

In WPF, when selecting a TreeViewItem, how do I Focus on another control but still complete my TreeViewItem selection?

This sounds like a tricky question... let me ellaborate... I have a treeView. When a treeViewItem is clicked/selected, I would like another TextBox to be focused. The problem is that as soon as I add code to Focus the Textbox, it looks like the TreeView does not Show its selected node anymore (i.e. the treeItem is not Selected at all (...

WPF: Asynchronous progress bar

I'm trying to create a progress bar that will work asynchronously to the main process. I'm created a new event and invoked it however everytime I then try to perform operations on the progress bar I recieve the following error: "The calling thread cannot access this object because a different thread owns it" The following code is an at...

Wpf Combobox Rounded Corners

hi, How can i make a combobox edges rounded..?.I have tried in blend,but no success till now..Any input will be highly helpfull ...

How can I convert 'System.Windows.Input.Key' to 'System.Windows.Forms.Keys'?

I'm developing application in WPF but some components are written using WinForms. I wan't these components to pull key gesture from WPF part and convert them to Keys enum (used in WinForms). Is there a built in converter for that? (probably not) Do you know "easier than big switch case" method to do that? ...

One sentence explanation to MVVM in WPF?

I heard its the next best thing in building WPF UIs, but all existing examples have dozens of lines of code - can I get a Hello World for MVVM that explains in no uncertain terms what its all about? I'm fairly new to C#/.net as well, so maybe point me to some resources that could help too? Much appreciated! ...

WPF dependency property return value

I'm fairly new to WPF. Suppose I defined an int dependency property. The purpose of the DP is to return the value+1 (see code). In .Net 2.0 I would have written: private int _myValue = 0; public int MyValue { get { return _myValue + 1; } set { _myValue = value; } } How would you declare a DP that achieves ...

ListBox working on WPF but not on Silverlight

I've got a style: <Style x:Key="StarPathStyle" TargetType="Path"> <Setter Property="StrokeThickness" Value="1"/> <Setter Property="Stroke" Value="#FF000080"/> <Setter Property="StrokeStartLineCap" Value="Round"/> <Setter Property="StrokeEndLineCap" Value="Round"/> <Setter Property="StrokeLineJoin" Value=...

WPF ListView - how do i set selected item background colour?

Hi, I currently have this, but it only work for the foreground colour. Any help would be apriciated :D <Style.Triggers> <Trigger Property="IsSelected" Value="true"> <Setter Property="Foreground" Value="Red" /> <Setter Property="Background" Value="Green"/> </Trigger> </Style.Triggers> ...

Where are types registered in Prism?

In the Prism Commanding_Desktop QuickStart solution, in the OrderModule, it defines a variable to the following: this.container.Resolve<OrdersEditorPresentationModel>() but where is this being registered so that it can be "resolved" out of the container? I see below where OrdersRepository is being registered, but I find no where in th...

Create WPF GridView Columns Automatically

I need to create a table structure that will automatically create columns for a collection of objects (the structure of which is pretty flexible). The data in the table will only be read only so I've been looking into using a GridView but can't figure out how to automatically generate the columns - has anyone got an example or a URL expl...

Can someone explain the magic going on in Prism's resolve<> method?

I've got a CustomersModule.cs with the following Initialize() method: public void Initialize() { container.RegisterType<ICustomersRepository, CustomersRepository>(new ContainerControlledLifetimeManager()); CustomersPresenter customersPresenter = this.container.Resolve<CustomersPresenter>(); } The class I resolve from the cont...

Is there a .NET control similar to Firefox's Address/Location/Awesome bar?

Is there a .NET component out there that is similar to Firefox's location bar? I need all the features of the Firefox address bar, but I want to control the "history" from which the suggestions are made. This is for Winforms or WPF. ...