Currently, I use value converters to generate user-friendly strings for the GUI. As an example, I have a window that displays the number of available entities in the status bar. The Viewmodel simply has an int dependency property that the calling code can set, and then on the binding for the textbox that displays the number of entities...
I'd like to create a customized checkbox that behaves exactly like StackOverflow's "accept answer" checkbox:
That is, I simply want to display a single image when checked, and a single different image when unchecked. I don't care about indeterminate state.
I'm a bit of a newbie when it comes to WPF ControlTemplates, so I'm...
I have a TreeView with a few objects bound to it, let's say something like this:
public class House
{
public List<Room> Rooms { get; set; }
public List<Person> People { get; set; }
public House()
{
this.Rooms = new List<Room>();
this.People = new List<Person>();
}
...
I'm trying to set the DataContext on ApplicationMainWindow which is a WPF window. When I set it up in the XML like so it leaves the DataContext null:
<!-- View Models -->
<component
id="mainwindow.viewmodel"
type="ProjectTracking.ApplicationMainViewModel, ProjectTracking"
inspectionBehavior="none" l...
I still didn't get it. Could you please show me exactly how to override ListBox's default behavior.
Everytime when ListBoxItem is selected the Border's background should be changed. Not the background of the whole row but only background of the border which's specified.
<ListBox ItemsSource="{Binding Source={StaticResource Asset...
I have a quick question regarding debug and release in VS 2008.
I have an app i've been working on - its not yet complete but the bulk of the functionality is there. So basically i'm trying to give a copy of it now to the person helping with documentation - just so they can have a play and get the feel for what i've made.
Now the quest...
when we bind to heterogeneous collection of objects, not all objects have the same set of properties. in the output window we get a message like:
System.Windows.Data Error: 39 :
BindingExpression path error:
'RoundingFactor' property not found on
'object' ''MultiLineTextMarkingScheme'
(HashCode=7262386)'.
BindingExpression:...
When hosting WPF user controls within a WinForms MDI app there is a drawing issue when you have multiple forms that overlap each other that causes very distinct visual artifacts. These artifacts are mostly visible after dragging one child form over another one that also hosts WPF content or by allowing the edges of the child form to be c...
My Problem is that I want to check if the Arrow up or down key is press then I want to increment or decrement value in the textbox control. I have registered keyup event but I have to release the arrow up key in order to change the value, What I want is if User pressed up arrow key then it will increment the value until user release up a...
I have a 3rd party control which among other things performs loading of some data. I want my viewmodel to keep track of this load operation and adjust its own state accordingly.
If it were up to me, I'd do the data loading far away from the view, but it is not. So, I seem to be in the situation where my viewmodel depends on my view. How...
I want to detect when a user clicks on an item on a listview, without using events as I do command binding and I don't like all the nonsense of the behaviours. I have tried this:
<ListView x:Name="MainList" Margin="2,8,6,8" Background="Black"
ItemsSource="{Binding Path=AssetsVM.Data, Mode=OneWay}"
BorderBrush="{x:Null}" >
<...
I'm writing a user control in WPF which is based on a ListBox. One of the main pieces of functionality is the ability to reorder the list by dragging the items around. When a user drags an item I change the items Opacity to 50% and physically move the item in an ObservableCollection in my ViewModel depending on where the user wants it. O...
I want to change the source in XAML to another object source. For example:
I have a Listview, part of a window bound to a "Model A", it has many properties, but one is called "Total". This property is not shown on the View
Each ListviewItem has its own source (ItemsSource), BUT, one of the fields should show "Total" from "Model A"
Ca...
I have an application which has different font sizes for different controls say Button: 10, TextBlock : 12 etc.
I want to give options to the user where he can select any one of the below say
Normal , Small, Big, Bigger.
Suppose one selects "small" I would want to decrease every distinct font size by 2.
If "Big", I would want to increas...
How can I return the key, mean if I want to allow only interger value in the textbox , how can I don't allow user to not enter value other then integer, regarding, keypress event, I know there are other ways such as expression to match the string value, but I want to not assign invalid value to the textbox.
if (( value >0 a&&(value <=9)...
I have a problem with a TextBox in an application...
A window has a Grid with two columns. The left column contains a control with a constant width but with a height that adapts. The right column contains a TextBox that takes up all remaining space in the Grid (and thereby in the Window).
The Grid is given a minimal width and height a...
I am creating a WPF application that will use IDataErrorInfo data validation, which my business objects implement. I have been working with this demo from a blog post to understand ValidatesOnDataErrors.
The demo is a trivial app that binds a couple of text boxes to a Contact object and implements IDataErrorInfo validation, using Valida...
In my wpf application I am using custom styles for most of the controls and want to do same with ListView. This style is in a separate resource project, which has customcontrols written by overriding the existing wpf controls and applying a custom styling to them. This project is shared among other projects which are using the controls d...
I have WPF Form which has many buttons with the same code. Appearance of all buttons must be the same
For example, code for one of these buttons
<Button x:Name="btnAddRelative" Width="120" Click="btnAddRelative_Click" >
<Button.Content>
<StackPanel Orientation="...
I have a strange problem with a WPF DataGrid from WPF Toolkit. The scrollbars appear correctly when the number of rows grows, and the scrolling works when you press up or down arrows on the scrollbar.
The problem comes in when I try to drag the scrollbar on the datagrid. My page has a scroll viewer around it. When I click and drag the s...