How can one obtain the panel that is used within a TreeView? I've read that by default TreeView uses a VirtualizingStackPanel for this. When I look at a TreeView template, all I see is <ItemsPresenter />, which seems to hide the details of what panel is used.
Possible solutions:
1) On the treeview instance ("tv"), from code, do this:...
I have a TextBox that I wish to reset its Background property to its default value after changing it to a different colour.
I have tried setting it to SystemColors.WindowBrush, but then, if the Display Settings are updated to change this value, it doesn't get dynamically reflected in the TextBox (it does normally if TextBox.Background h...
I would like to know how to bind a custom datatype to a treeview.
The datatype is basically arraylists of objects that contain other arraylists. Access to would look something like this.
foreach (DeviceGroup dg in system.deviceGroups)
{
foreach (DeviceType dt in dg.deviceTypes)
{
foreach (DeviceInstance...
Hi,
I've had to write an application that lists and plays tutorial videos along with accompanying text. It works well but since the videos are added by the user I need a way of checking to see whether or not a video can be played on the machine.
I'm not sure whether or not there is an easy way to try test the file (and catch errors) or...
What ways can the SampleConfirmationDialog be unit tested? The SampleConfirmationDialog would be exercised via acceptance tests, however how could we unit test it, seeing as MessageBox is not abstract and no matching interface?
public interface IConfirmationDialog
{
/// <summary>
/// Confirms the dialog with the user
/// </s...
Good day,
I am in the middle of development of a WPF application that is using Entity Framework (.NET 3.5). It accesses the entities in several places throughout. I am worried about consistency throughout the application in regard to the entities. Should I be instancing separate contexts in my different views, or should I (and is a a...
Hi all. I'm trying to get the green box that appears on the second click of a tri-state checkbox to be red, and also to fill up the box.
I found an article here that demonstrates a little bit about using templates to do this:
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/98cf8a65-f4ca-4ff5-9851-c2989b91a013
However, I can't...
Hi,
I am using Datagrid in WPF. This is a very simple and basic implementation. I not using any styles.
I created a simple datagrid :
<dg:DataGrid x:Name="dg" >
</dg:DataGrid>
and populated it with data as:
dg.ItemsSource = " H E L L O W O R L D!".Split();
Grid gets properly populated but the columnheader of the grid i...
The method for drawing a line on a canvas in WPF that uses the line class actually draws a line that is two pixels thick:
Line myLine = new Line();
myLine.Stroke = System.Windows.Media.Brushes.Black;
myLine.X1 = 100;
myLine.X2 = 140; // 150 too far
myLine.Y1 = 200;
myLine.Y2 = 200;...
I am trying to bind a 2D array of buttons arranged in stackpanels to a 2D ObservableCollection...
Yet, I'm afraid I don't understand something very elementary about binding.
My XAML:
<Window.Resources>
<DataTemplate x:Key="ItemsAsButtons">
<Button Content="{Binding}" Height="100" Width="100"/>
</DataTemplate>
<...
I have a MemoryStream of 10K which was created from a bitmap of 2MB and compressed using JPEG. Since MemoryStream can’t directly be placed in System.Windows.Controls.Image for the GUI, I am using the following intermediate code to convert this back to BitmapImage and eventually System.Windows.Controls.Image.
System.Windows...
Hi, I'm a bit new to WPF. I am working on a list UI where each item in the list will have a set of corresponding buttons to operate on that particular data item.
Coming from a web background, I normally would have bound the value into a hidden element in that particular list item or something. However, I just need to find the correspon...
I am having some issues trying to learn WPF. What I am trying to do is to bind a class that has a string and an array of strings. I would like to bind the string as the title and array as the contents of an expander, but I am having difficulties. What am I missing to make this work? Any help would be appreciated, TIA.
This is the co...
Each datatemplate in my WPF ItemsControl contains FIVE custom bindable richtextbox controls.
It is a data-driven app that for authoring multiple-choice questions --> The question and four answer choices must all support:
1) Spell check
2) Rich formatting (otherwise I'd use regular textboxes)
The spell check object in .NET 4 has a Frie...
As I wrap my head around the mvvm thing, the view is the view, and the viewmodel is 'a modal of a view' and the model are the entities we are dealing with (or at least that is my understanding). But I'm unclear as to what and when the model entities are populated. So for example:
Lets say I have app that needs to create a new record i...
Code Sample:
<DataTemplate x:Key="NodeDataTemplate">
<Border Style="{StaticResource nodeBorderStyle}"
MouseEnter="SetMouseCursor_Arrow"
MouseLeave="SetMouseCursor_ScrollAll"
MouseLeftButtonDown="ViewLink"
MouseLeftButtonDown="SetFlagForCu...
Hi !
I have 3 TextBoxes to edit a DateTime.
What is important to notice is that those 2 TextBoxes are editing the hour and minutes of the first TextBox DateTime value.
One to edit the Date and 2 to edit hour and minutes.
How would you do that? The code below doesn't reflect the DateTime changes when editing the hour or minute, because i...
The wired problem is, in VS 2008, everything works fine. In VS2010 while serializing, it is missing the "ReportDimensionElements" so I'm unable to get the values back from the serialized value back from the XAML. It says, "'ReportDimensionElements' is null" am I missing anything silly.
Note: I have marked the ReportDimensionElements cla...
I have a WPF Window that open a modal child window to load some data. Both window have a own viewmodel, now I have this problem: after I close the child window it seems still running in background!
To close the child window I set DialogResult from viewmodel command; now, if I create a new data and then I edit it from parent window (with...
In a MVVM approach how would I go about binding to Properties.Settings? Is there a way to bind a property in C# code(in the ViewModel) to another property(Properties.Settings.Default) or should i just bind to standard properties and on save make sure each property gets propogated manually to the Properties.Settings?
...