wpf

Surface WPF ScatterViewItem with DocumentViewer data binding problem

I've got an issue with data-binding with a WPF application I'm working on. Essentially I've got a class document which contains a IDocumentPaginatorSource property containing the contents of an XPS document. In my Main Window I've got a ScatterView which I create ScatterViewItems for programmatically. When a button is pressed, a new Docu...

SizeToContent on UserControl

In fact the UserControl lacks the property 'SizeToContent' that we have in Window. So the question is: what's the easiest and right way to simulate SizeToContent=WidthAndHeight behavior on UserControl? UPD... yeah I know it suppose to get that automatically if no Height and Width defined in the container where you're placing a user c...

WPF element limits causing objects to not draw?

I have a fairly heavyweight application running inside a container application. Users will likely want to create up to 20 instances of this application to run side-by-side within the container. After the 15th instance, the WPF elements no longer draw. ActiveX components still work as expected and I can interact with the rest of the ap...

WPF: Attached behavior is registered but never called?

Hello all, trying my first attached behavior: I want to bind the TextSelection of the RichTextBox to my ViewModel`s property: public TextSelection SelectedRichText {get;set;} That way I bind it: <RichTextBox behavior:RichTextBoxSelectionBehavior.RichTextBoxSelection="{Binding SelectedRichText}" /> Thats my code and I have 2 quest...

How well is WPF being adopted?

I love programming in WPF and .NET in general. It's extremely powerful, flexible, and you can do cool stuff in it. But I'm a little worried about whether it's getting much traction. When I talk to other sw engineers people don't seem to know much about it and the WPF sections on lots of online developer forums tend to get very light ...

WPF DI Service Locator

So I'm looking for some clarification how it would be possible to remove the service locator from my application. I have a ViewManagerService that is responsible for knowing which view is active, which views are open and creating a new view. Currently my ViewModels get an IViewManagerService injected into them via constructor injection...

How to bind to a property of a property in WPF

I have a listview who's itemssource is a ObservableCollection of MyModel. I am trying to figure how to bind a textbox text's property to the Name property of the model's Owner property public class Person { public string Name { get; set; } public string Address { get; set; } //... } public class MyModel { public string...

WPF Submenu styling

I have a ContextMenu style and a MenuItem style, both of which are working properly on the top menu. The problem is if I add a submenu to a menu item, then the submenu is not being styled properly. It looks like you can only style the menuitem at this point, and not the actual sub menu so you can't replace the IsMouseOver styling (it j...

Accessing a datatemplate control in WPF programmatically

In my WPF application I have a list of DocumentViewers which are bound to some property of an object. I add the object to a ListBox and programmatically apply a datatemplate which binds the property of the object to the DocumentViewer. This means the DocumentViewer isn't declared at all in the code, but I want to get at it to change a pr...

Referring to a brush resource in a VisualState ColorAnimation

I'm trying to style the Calendar control and need the buttons to adopt the colors we already have defined as named resources. But the storyboards require colors in the ColorAnimation, and I'm not sure how to use a brush there. For example, I need to turn this <VisualState x:Name="MouseOver"> <Storyboard> <ColorAnimation Duration="00...

WPF, linking together two XML data sources in cascading ComboBoxes

I have XML in the following format: <Products> <Product name="MyProduct1"> <Components> <Component name="MyComponent1"> <Teams> <Team id="1"/> <Team id="4"/> </Teams> </Component> </Components> </Product> </Products> This is stored in an external XML file that is included via...

WPF Databinding with object source fails to update

Dear all, I have been struggling a while with this problem and read a lot but most of the examples are too simple. I am trying to bind a very simple ObservableCollection to a DataGrid. The super simple objects within the Collection are "SingleItems" which are defined like this: public class SingleItem { private String _name=null; publi...

search arraylist by property using binarysearch

Hi, I currently have an arraylist containing classes in C#. The arraylist is filled like this: foreach (XmlElement Path in locaties) { ISoundSource track = engine.AddSoundSourceFromFile(Path.InnerXml); mixarray.Add(track); } then the array ha...

In WPF, how can I make data from one binding feed into multiple columns?

I am trying to display an array as grid of numbers, with multiple columns and multiple rows. I set up a ListView with multiple columns bound to my array, but the elements are repeated in each column, so that the data looks like: -------+--------+------- First | First | First Second | Second | Second rather than: -------+--------...

WPF: Add an "Always On Top" menu item to the system menu

I have a monitoring tool where some, but not all, users want it to be displayed always on top. I would like to add this option to the system menu in the upper-left corner. How would I do that? ...

WPF: Dynamically change ListBox's ItemTemplate based on ListBox Items Size

I need to change the DataTemplate of my ListBox, based on the ListBox items count. I have come up with the following XAML: <Window.Resources> <DataTemplate x:Key="DefaultTemplate"> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Path=Text}"/> <TextBlock Text="default template" /> </StackPanel> </DataTem...

WPF Style DataTriggers

Hi I have a Data Trigger in a style targeting a TextBlock where I am trying to change the Text and background of a TextBlock <DataTrigger Binding="{Binding ElementName=..., Path=IsVisible}" Value="False"> <DataTrigger.Setters> <Setter Property="Text" Value="Collaps"></Setter> <Setter Property="Background" Value="Somethin...

WPF: Navigation/Design: How to keep track of state so I can change appearance of buttons?

I have an application that has a top level navigation menu which consists of series of buttons within a stackpanel. When a user clicks on a button the view model processes the command and updates the value of CurrentView (type UserControl). The CurrentView is bound to the element ContentControl as below. <ContentControl Content="{Bindin...

Sharing login between multiple WPF applications?

Hello. How can I share login between multiple WPF applications? that is, if one application logs in to the server, I want other applications get logged in too, and if I log out from one application, other applications get logged out too. I know this can be done using cookies in ASP.NET applications. I've looked towards using 'Client ...

How can i access Dynamic objects from code behind to .xaml file ?

Hi friends, I am new to wpf.I want to apply animations for r1,r2,r3,r4,e1,e2. I have to access these object names in my .xaml file for writing storyboards so that i can apply animations.How can i acces these object names in .xaml file? Can you send me sample applicationsfor how to create dynamic objects and how to access it into .xaml fo...