I have a custom control template for a listview that puts an extra line in for each record, thats defined something like this in Window.Resources...
<ControlTemplate TargetType="ListBoxItem">
<Border>
<StackPanel>
<GridViewRowPresenter>
<TextBlock Name="myTextBlock" />
</StackPanel>
</Bor...
I have been working with WPF and the MVVM pattern for a while now. I'm having difficulty getting validation working in a "normal" way:
1) I'm implement the IDataErrorInfo interface in my ViewModel. The XAML looks something like:
<TextBox Grid.Column="1"
Grid.Row="1"
Text="{Binding Path=ProjectKey, ValidatesOnDataErro...
I have a usercontrol with the Dependancy Property of "Answer" which is attached to a textbox.
I have queried the database and bound the answer to the usercontrol and the correct value is displayed.
The issue occurs when i edit the textbox, the PropertyChanged event is not fireing and thus preventing me from saving the correct value bac...
I'm having problems validating an email address in my View Model. Property I'm checking is -
[ValidatorComposition(CompositionType.And)]
[SOME Operator("EnabledField")]
[RegexValidator("\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*", Ruleset = "RuleSetA",
MessageTemplate = "Invalid Email Address")]
public ...
I like MVVM. I don't love it, but like it. Most of it makes sense. But, I keep reading articles that encourage you to write a lot of code so that you can write XAML and don't have to write any code in the code-behind.
Let me give you an example.
Recently I wanted to hookup a command in my ViewModel to a ListView MouseDoubleClickEvent. ...
Obviously, the straightforward answer to the question is "No", but what's the best way for me to achieve that kind of effect? To explain, here's a bit of background...
I have an app that displays an Image plus a couple of layers of overlaid shapes on that image. All of these are placed within a Grid cell, overlapping each other, with th...
My application collects business data from various sources, aggregates it, groups and filters, and needs to display it. Pretty uncommon, right? =)
The point is that I already have a "drill-down" UI, so the Services and Operations people can find their data in the tree view and do their job. But now I also need a shiny high-level dashboa...
I would like to use the BackgroundWorker to perform a db transaction from a GUI.
How can I command the BackgroundWorker to perform the work and then WAIT for the worker to complete while keeping the GUI responsive?
Do I have to use DoEvents for this purpose, or is there another way?
...
Hello,
I have a TreeView and a couple of other controls like TextBoxs and ComboBoxs.
The textboxes are bound to the selected item in the treeview like this:
Text="{Binding SelectedItem.Name, ElementName=groupTreeView}"
This works fine if all the elements in my treeview have a Name Property.
I was wondering if there was a way to do so...
Hi All,
I am working on a WPF application similar to visio. I would like to be able to logically group some of the items in my diagram, each of which is a UIElement, and control certain behaviors (i.e. visibility) at the group level.
My first attempt at this was to create a control, called a Group, which had width & height = 0. I w...
I am trying to use in WPF a validating input of databound controls with validation rules. In the code behind file of a wpf window I have a class:
public class posintValidationRule : ValidationRule
{
public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
{
...
I have a ControlTemplate that I'm using to change the appearance and behavior of several Buttons. I only want part of the Button to be clickable and to execute the bound Command, so I added a Button within the ControlTemplate and bound it to the template's Command property.
The problem I'm having is that since I am defining the Command ...
Using WPF, I have a ListBox control with a datatemplate inside it. The relevant XAML code is shown below:
<ListBox Name="_todoList" Grid.Row="1" BorderThickness="2"
Drop="todoList_Drop" AllowDrop="True"
HorizontalContentAlignment="Stretch"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
Alterna...
I posted a question a few months ago about sharing resource dictionaries across assemblies. It turns out you can do that using the Component Resource Key markup extension. At the time, I could only get it working with a WPF Custom Control project, not with a plain Class Library project.
Now I need to use an existing plain Class Library ...
Hello all,
Does anyone know a WPF control/app that functions like the google Finance graph/chart?
Thank you.
...
I want to be able to edit xaml in vs 2008 and be able to view the results without going crazy waiting for the wpf designer to draw the xaml.
I downloaded xamlpadx (v. 4) and kaxaml. They both look great, but it seems that they can only edit xaml without any custom namespaces. This makes it impossible for me because I'm using mvvm and am...
Note: I will use the term "ViewModel" for both the ViewModel in WPF/Silverlight and the strongly-typed ViewData in ASP.Net MVC in the following text.
I would like to create both ASP.Net MVC and WPF/Silverlight clients for the same project (in other words, against the same DataModel), should I create a common ViewModel project or a separ...
I want the ContentTemplate to vary according to the value in the DataTrigger.
And yes, I considered using a DataTemplateSelector, but now I need a DataTrigger or better said a MultiDataTrigger.
Please take a look at the following sampe app, the DataTemplate doesn't change:
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.co...
Hi everyone,
I am setting different text to a textblock depending on what control has been selected as a way of providing help for the user.
What I would like to do is in the code behind file, when one control is selected, provide a brief explanation in text, then provide a link to a text file within that textblock.
It might look lik...
I'm trying to display a Wpf Treeview with items sorted by a CollectionViewSource.
Currently, everything is working except sorting using this code in my resource dictionary:
<HierarchicalDataTemplate DataType="{x:Type books:Container}" ItemsSource="{Binding Path=Items}">
<nav:ContainerControl />
</HierarchicalDataTemplate>
What wo...