I have UserControls within UserControls in WPF. This makes a tree structure starting from the root node.
I want to register for the event MouseLeftClickDown in all the UserControls. Left Clicking on a child control causes the event to fire for that control and all the parent controls that contain that child.
When I click a child, I do...
HorizontalContentAlignment is not applied to textbox....
Here is the style definition:
<Style TargetType="TextBox">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
and here is the TextBox definition
<DockPanel LastChildFill="True">
<TabControl DockPanel.Dock="Top" Name="tabControl1">
<...
In MVVM it is normal to connect View to the ViewModel with data binding.
Therefore if the name of a properties changes on one of the Model objects that is databound to there is no compiler error.
When the compiler will not stop a bug, the next thing I think of is “UnitTest”, However
How do you unit test this without
spending for...
I'm trying to figure out a way to bind my checkbox IsChecked property. Basically, I have a list of items which the ListBox is bound to. When a user checks the box, a command is invoked and that item is added to a collection.
However, what if I want to programmatically select items in the list? I would like the IsChecked item to be ba...
Well i have a custom control and when Visibility is changed to Visible i have a trigger with a enter/exit action but the problem is that when the exit action fires the Visibility is no longer Visible so the animation can't be seen how would i fix this?
here is my trigger:
<ControlTemplate.Triggers>
<Trigger ...
The following code in a WPF app creates a hyperlink that looks and acts like a hyperlink, but doesn't do anything when clicked.
What do I have to change so that when I click it, it opens the default browser and goes to the specified URL?
XAML:
<Window x:Class="TestLink238492.Window1"
xmlns="http://schemas.microsoft.com/winfx/200...
How do I bind the height of TextBlock to the height of the parent control?
I have a TextBlock inside a grid and I want the TextBlock height & width to be the height & width of the grid cell without hard coding the values.
Cheers
AWC
...
I've just been reading Josh Smith's MVVM article and am working on a WPF application at the moment. I'm umming and ahing about transfering my work so far to MVVM but find the idea of working purely through databinding and ICommands without any UI event handlers, a little daunting in the sense that it could take a while to convert what I...
Update: I've corrected the post, so the question is closed.
Expected result:
Menu width must be equal to the main window width.
Here is full code:
<Menu Name="menu1" DockPanel.Dock="Top">
<Menu.Width>
<Binding Path="MainWindow.Width"
Source="{x:Static Application.Current}"
UpdateSourceTrigger="P...
I am trying to raise a custom built attached event on a button click. If I add handlers in the code, they are hit when the button is pressed but if I use the event in a WPF Trigger for animation, it doesn't work.
The Triggers that use the custom Attached Event is defined in a ControlTemplate for a CustomControl.
The same code works fo...
I am using SampleGrabber in DirectShow on windows 7, I noticed that the Code supplied by Microsoft and many other providers dont work because the Bitmap data header reports that bitmap data is compressed, however the new Bitmap(width, height, stride, pixelformat, scanlines) doesnt have any parameters to specify that the buffer has compre...
I've currently created the class below. For some reason though I can't access the properties I've created through my xaml style.
Public Class Ribbon : Inherits Button
Private mpopDropdown As Popup
Public Property Dropdown() As Popup
Get
Return mpopDropdown
End Get
Set(ByVal value As Popup)
...
I have a class that implements IEditableObject and now I'm wondering if it's possible to call BeginEdit() automatically when the source of the binding is updated?
There are two possible scenarios:
Object gets populated via the database. In this case, I don't want to call BeginEdit().
Object gets populated via the input fields by user....
I have built a Flex application that composes image resources, color layers, blurs etc to generate images (99% of the drink images in www.absolutdrinks.com are generated by this app). One of the effects used by the app is Flash's ability to apply displacement map filter in which x- and y- offset for an image is defined by a 2D image (sy ...
I have a UserControl that adds a CommandBinding to it's CommandBindings collection to handle a specific Command. Later I use this control in a window and want to add another binding to that same control to add additional behavior. The problem though, is that when I do this it seems that when I add another CommandBinding to the CommandBin...
I am just working on my first GUI application on Windows.
I have a WPF GUI to a small C# utility which copies files. When the button is clicked to copy, I obviously don't want the GUI to hang. So, I fire off a new thread to run the method which copies the files. I assume I'm on track so far and there's no "better" way of doing it in C#?...
I have a WPF UserControl with binding converters referenced like this:
<UserControl x:Class="MyControl" x:Name="MyControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:TheMainNamespaceOfThisAssembly">
<UserControl.Resourc...
I have a separate thread that listens for data. And on receiving some data it needs to access one of the windows in the app and set some fields for that window.
Right now when I use this it throws an exception(saying this threads cannot access as Windows1 is owned by other thread):
foreach (Window w in App.Current.Windows)
...
Hi!
I want to alternate the background of the listviewitems by binding a converter to the background border of each listview item.
listview.xaml:
<l:cBackgroundConvertor x:Key="myConverter"/>
<Style x:Key="{x:Type ListViewItem}" TargetType="ListViewItem">
<Setter Property="SnapsToDevicePixels" Value="true"/>
<Setter Propert...
I have a Window set to the height and width of my monitors:
var r = System.Drawing.Rectangle.Union( System.Windows.Forms.Screen.AllScreens[0].Bounds, System.Windows.Forms.Screen.AllScreens[1].Bounds );
Height = r.Height;
Width = r.Width;
This is all fine until I Lock my computer (WIN+L), when I come back the window has resized itself ...