wpf

How to display two ObservableCollections as a single list in WPF?

I have two ObservableCollections, say ObservableCollection<Cat> and ObservableCollections<Dog>. Cat and Dog both derive from class Pet. I want to display a list of all Pets. How do I do this? I prefer not want create a new ObservableCollection<Pet> by adding items from the two source lists because this list will become stale as more Cats...

How to add columns at runtime in WPF DataGrid from ViewModel?

I don't have the column names at compile time. I would be available in an array of strings at runtime. I need to read this array and create columns for wpf datagrid. I have MVVM pattern setup and my View has the DataContext setup to ViewModel. I am able to use ObservableCollection and make it work, but I have to fix the column number/na...

WPF Global Resources in App.xaml

I have created a custom Treeview control and am trying to access the HierarchicalDataTemplate resource of this control from another page in the same project. my this.sceneTemplate property is coming up null. I have looped through all the objects in the dictionary and it does exist. How can I access this template? Thanks App.xaml <A...

Detecting if an item is selected or not in a listbox (WPF)

Hi, I want to know how you can know if an item selected or not in the items array of a listbox. The listbox allows multiple selections so I need to iterate all of them and see which are selected and which are not. Many thanks (I know - short and sweet) ...

WPF DataGridComboBoxColumn`s ComboBox is only visible when DataGrid has IsReadOnly=FALSE

Hello, Why is the ComboBox in that column only visible via double-click in the empty cell when the DataGrid is set to IsReadOnly = FALSE ??? <DataGridComboBoxColumn Width="*" IsReadOnly="False" Header="test" /> using a DataTemplateColumn works as always... whats wrong with that DataGridComboBoxColumn? works: <DataGridTemplateColum...

WPF web browser navigating is getting called twice & hence seeing navcancl.htm page

Hi, we are implementing a WPF webbrowser in our desktop application in c#. The browser is given the uri and its purpose is to display the same. It works fine but sometimes it displays the navcancl.htm page. Upon debugging we found that in this case our URI is getting changed by appending res://C:\WINDOWS\system32\shdoclc.dll/navcancl.h...

Why does ActualHeight on VirtualizingStackPanel render to the entire content when used in a WPF TreeView?

So I'm attempting to use the WPF TreeView in its virtualization mode (Visual Studio 2010, NET 4.0). Having done a bit of research, I found a variety of settings and configurations were needed to get this to work, or so various people at MSDN claimed. However, having used Snoop on the same ObservableCollection (1000 items) when thrown at...

WPF Storyboard delay in playing wma files

I'm a complete beginner in WPF and have an app that uses StoryBoard to play a sound. public void PlaySound() { MediaElement m = (MediaElement)audio.FindName("MySound.wma"); m.IsMuted = false; FrameworkElement audioKey = (FrameworkElement)keys.FindName("MySound"); Storyboard s = (Storyboard)audioKey.FindResource("MySound.wma"); s.Be...

wpf DataGrid.datagridtemplatecolumn combobox does not update itemssource

<Grid Loaded="Grid_Loaded"> <DataGrid Margin="10,10,10,162" x:Name="dataGrid1" ItemsSource="{Binding myItemsSource}"/> <DataGrid Margin="10,164,10,10" x:Name="dataGrid2" ItemsSource="{Binding myItemsSource}" AutoGenerateColumns="False"> <DataGrid.Columns> <DataGridTextColumn Header="A" Binding="{Binding A}"></DataGridTextColu...

Cross-platform GUI toolkits with WPF-style composition capabilities

A huge advantage of WPF over, say, WinForms is its composability. To quote Programming WPF: One level up, WPF provides its “content model,” which allows any control to host any group of other controls. You don’t have to build special BitmapButton or IconComboBox classes; you put as many images, shapes, videos, 3D models, or whate...

[WPF or other 3D tech] Light Map projection

Hi, What i'm trying to do is making a "light projector" with visible ray(like with fog) also called volumetric light; and which project a image (bitmap) ; Because i would like to keep this project connected with a wpf application ( to get brush, position, rotation from data), i've choose to use WPF 3D But it seem that WPF can't hand...

C# Oracle Database 10g issues

Well, the problem is as follows: I have a WPF Application built using the C#, I have known how to connect to oracle database engine, yet I need some help in it. first, I want to know how to add the server to the connection string ... OleDbConnection conn = new OleDbConnection("provider=MSDAORA;data source=ORCL;user id=SCOTT;password=T...

MVVM Practice for accessing the entire view.

Still a bit new to the concept of M-V-VM in WPF, here's my problem: I've built up my ui pretty cleanly, I have the following: CareersView.xaml - View CareersView.xaml.cs - View (Code Behind) CareersViewModel.cs - View-Model Career - Model The View-Model is all wired up through bindings and cleanly keeps all logic inside it for testa...

How to set widths of columns in Listview in WPF?

Hello, I have a listview and I need to have width of first column automatic (so the width is properly measurized) and second column that will take the rest of space in the head of listview. How can I do that? My XAML looks like this right now: <ListView HorizontalAlignment="Stretch" ItemsSource="{Binding ListViewItemsSource}" ...

WPF: Binding DataGrid to a list<Product> having a DataGridComboBoxColumn bound to a list<Category> ?

Hello, I have a DataGrid with ItemsSource set to a list of products and I have a DataGridComboBoxColumn inside the DataGrid with ItemsSource set to a list of categories. That way I want the user to choose a certain category for each product. I always get the binding error: BindingExpression path error: 'Categories' property not found...

Anyway to load RDL report content into a WPF FlowDocument or similar?

I would like to know if someone have created a RDL report (running it in Reporting Services), and loaded it into a WPF component like FlowDocument. Since RDL is just a XML, perhaps there's a way to parse the result and avoid using this WindowsFormsHost in order to use the Report viewer control. Would be really nice to have another cont...

Hosting ActiveX control in WPF

I have an ActiveX control (written in Delphi) which I want to host in a WPF application. When I try to load it into the toolbox to add it to the XAML at design time, it is not shown in the list of available controls. Does anyone know what filters this list and why I can't see the control to add it? Edit This is where I get to - the hos...

WPF Binding with INotifyPropertyChanged does not update

I appear to be having serious problems getting my WPF UI to update when I update when I update the property it is bound to. Here is my view model class definition: namespace WpfModel { class AppModel : INotifyPropertyChanged { private int _count = 7; public int Count { get { return _count; } ...

Testing DirectX applications in Virtual PC?

I would like to test my WPF applications using Windows Virtual PC under Windows 7. In my C# code, I'm checking the WPF tier and if it's less than 2, I disable a DirectX call. In order to test on Windows XP, I'd like to use Windows Virtual PC but it seems to only run in software mode. Thus, the tier is always <2. Any ideas on how to enab...

WPF drag cursor in default cursors

I'd like to use the default drag mouse cursor on mouse-over a UIElement to indicate a control is draggable. The cursor that looks like an arrow and a FocusVisual rectangle with an overlapping plus sign inside a rectangle. Basically, the cursor that is used when setting DragDropEffects.Copy during a drag operation. However I'd like to...