I'm adding TreeViewItems manually in code behind and would like to use a DataTemplate to display them but can't figure out how to. I'm hoping to do something like this but the items are displayed as empty headers. What am I doing wrong?
XAML
<Window x:Class="TreeTest.WindowTree"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/p...
I'd like a SaveFileDialog with the following behavior:
The first time you open it, it goes to "My Documents".
Afterwards, it goes to the last selected folder.
What's the best way to accomplish this?
If I don't set the InitialDirectory, it goes to the exe's directory - which is not what I want. It rememebers the last selected director...
I am looking for a way to expose a property in my ViewModel and have it influenced by two separate controls in my View.
In code view, I am trying to do something like this:
propdp object MyObject...
<MySelector SelectedItem="{Binding MyObject, Mode=TwoWay}" />
<MyEditor DataContext="{Binding MyObject, Mode=TwoWay}" />
The purpose of...
I have been considering using the code example shown at Shell Style Drag and Drop in .NET - Part 3 within a WPF project. The sample project works fine, it is a great article so check it out!
However when moving the code to my project I receive an error when compiling "Unsafe code may only appear if compiling with /unsafe" I understa...
Hi
I have a combobox with few items displayed as image and text (placed side by side for each item). Now when i select an item from the combobox list i want to display something else (instead of same image and text) maybe another text or another image on the Combobox selecteditem area.
Is there a way i can achieve it.
...
I have the following test code:
private class SomeItem{
public string Title{ get{ return "something"; } }
public bool Completed { get { return false; } set { } }
}
private class SomeCollection : IEnumerable<SomeItem>, INotifyCollectionChanged
{
private IList<SomeItem> _items = new List<SomeI...
I use the WPF Printing Path to handle big large diagrams created in our application. The whole diagram consists of visuals.
A so called "DesignerPaginator" paginates the diagram (it is quite simple).
From this point, I do the following three thing:
- I print the Document with PrintDialog.PrintDocument(Paginator, Title)
- I also create a...
I have to design a tab control. Tab item header should be shown verically.
...
Several other questions on SO have come to the same conclusion I have -- using an ItemsControl with a DataTemplate for each item constructed to position items such that they resemble a grid is much simpler (especially to format) than using a ListView.
The code resembles:
<StackPanel Grid.IsSharedSizeScope="True">
<!-- Header -->
<G...
I'm unable to use data binding in the ItemContainerStyle for a ListBox in Silverlight 3. It works fine in WPF. This is contrived example to demonstrate my problem. What I really want to is bind to the IsSelected property, but I think that this example is easier to follow.
I have a ListBox that is bound to a ObservableCollection<Item> of...
The WPF ListView control allows to re-order of columns by drag and drop.
Is there any way to disable it?
I hope some WPF guru can help me. :)
...
I have a WPF BitmapImage which I loaded from a .JPG file, as follows:
this.m_image1.Source = new BitmapImage(new Uri(path));
I want to query as to what the colour is at specific points. For example, what is the RGB value at pixel (65,32)?
How do I go about this? I was taking this approach:
ImageSource ims = m_image1.Source;
...
I have a TabControl whose items are bound to an ObservableCollection:
<TabControl ItemsSource="{Binding MyObservableCollection}" />
The tabs are added and removed as expected as items are added and removed from the collection. However, the SelectedItem reverts to -1 (meaning there is no selected tab) whenever the collection is empty. ...
I have Visual Basic Express 2008 and .net framework 3.5 on xp sp2.
I create a new wpf application, when I try run the application I get the following error.
" 'Error while trying to run project: Unable to start program 'C:\Documents and Settings\Mike\My Documents\Visual Studio 2008\Projects\WPF\bin\Debug\HelloWorld.exe' Access Denied"...
I've got an ItemsCollection hosted inside a ScrollViewer that is large enough to span multiple pages when printed. I've so far managed to print a single page using PrintVisual(itemsControl) but from what I've read, I need to approach printing a single control accross multiple pages differently. Could anyone point me in the right directio...
I'm building a basic Composite WPF Shell with one Module. I would like to unit test my module. Apparently Composite WPF modularizes my code in such a way that it should be easy to unit test.
Below is the code I would like to Unit Test. It resides in my Module's Controller. Note the use of the standard Composite WPF entities like Region...
I'm in the process of building a Home Theatre PC (HTPC), and figured this could give me a small project to learn some more about WPF.
I want to build a simple program launcher. It would be an application that would fill the screen with a background of my choosing, and a few large icons/buttons to represent applications. I have an IR rem...
I have an EventTrigger that will stop a few storyboards that are defined in my XAML ... but now i need to stop a storyboard that I'm starting programmatically.
<UserControl.Resources>
<Storyboard x:Key="FadeIn"> ... Fade In Definition </StoryBoard>
<Storyboard x:Key="FadeOut"> ... Fade In Definition </StoryBoard>
</UserControl>
<Use...
I have added a tooltip (shown below) to the track in the slider template, but rather than binding to the current value of the slider, I would like to bind to the value corresponding to the "track value" the mouse is over. Similar to what the youtube video slider allows. So the user can mouseover the track and also see the corresponding v...
Hi,
When writing a MVVM WPF app, there's always a point where the view model has to be set to as the data context of the view. For me, usually that's in code. But I realized that if I declare the view model as a static resource inside the xaml and set the binding there, I don't need to do it in code anymore. This means I don't have to c...