.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Validate Binding that is part of a BindingGroup on LostFocus without updating source

Posted By:      Posted Date: October 07, 2010    Points: 0   Category :WPF

By default, when you tab out of a TextBox whose Text property is data bound, the value is pushed to the data source.  Data validation occurs as part of this process.

When you create a BindingGroup and the Binding becomes part of this BindingGroup, the value is no longer pushed to the data source when the TextBox loses focus.  This is what I want.  However, the data validation no longer occurs.  This is not what I want.

How do I validate a binding that is part of a BindingGroup on LostFocus without updating the source?  I want my users to have immediate feedback of data entry errors but I want to retain control over when data is pushed to the data source.

It would be great if this could be implemented as a style in a Theme.xaml file or any other solution that would not require hooking up to each and every LostFocus event handler in my application.

View Complete Post

More Related Resource Links

Trouble binding InfoPath "template part" to data source


I created an InfoPath template part using an XSD.  I added it to my custom controls, but when I try to insert it into the main template, it asks to be bound to a data source.  I have created a group to bind it to in the data source, and I created a "complete XML document or schema" based on the same XSD as well.  It matches the schema in the template part exactly.  The template part won't bind to either node.  I get the error message, "Requirements_Template_Part cannot be bound to the selected field or group." 


This XSD is complex and contains a repeating table.  I read somewhere that this might be a problem.  Unfortunately , the XSD cannot be changed much though this is a format imposed on us from another group.  A coworker is writing a transform to cull out the data from this XSD and feed it into another system.  He says he will update the XSD from time to time, and I thought that a template part would make it easy for me to update it whenever he updates his XSD.

Creating a SharePoint 2010 Web Part That Can Read and Write Data to an External Data Source

Learn to use Visual Studio 2010 to create a Visual Web Part that uses a BCS external content type in SharePoint Server 2010 to read and write data to the AdventureWorks sample database.

Sample: Creating a SharePoint 2010 Web Part That Can Read and Write Data to an External Data Source

Explore the code in this visual how-to article as you learn to use Visual Studio 2010 to create a Visual Web Part that uses a BCS external content type in SharePoint Server 2010.

Menu Data Binding from XML source

Hi , I have the following complex XML structure. I need to bind the values to menu via Binding from the XML source <Editions>      <Edition Name="A">            <Products>                  <Product Name="1">                        <Platforms>                              <Platform Name="11">                                    <A1 Name="A"/>                                    <B1 Name="B"/>                                    <C1 Name="C"/>  

TextBox shows binding source text when window load, so why not with the ComboBox?

How can I get a ComboBox to show the binding source value when my window opens?  I have been searching all day for a solution to this, but cannot find anything.  So I have created a sample project to demonstrate my problem.  Below is a Vehicle class, very simple, two members Category and Make.  Category is an enumeration, Make is a string. namespace ComboExample { public class Vehicle { // Constants and enumerations public enum eCategory { Road, Air, Sea } // Attributes public eCategory Category { get; set; } public String Make { get; set; } // Construction public Vehicle(eCategory Category, String strMake) { this.Category = Category; this.Make = strMake; } } } Here is the C# for the MainWindow.  A new Vehicle object is created as a member.  In the constructor I set a data-provider in the XAML to this Vehicle object.  There is a button event for showing the values of the controls and objects so I can check the binding. namespace ComboExample { // Interaction logic for MainWindow.xaml public partial class MainWindow : Window { // Attributes Vehicle m_Car = new Vehicle(Vehicle.eCategory.Road, "BMW"); // Construction public MainWindow() { InitializeComponent(); // link data-p

Binding the sharepoint treeview to the quick launch data source

Is there any way i can bind the sharepoint treeview navigation to the same datasource as the quick launch bar? I'm trying to create a consistent navigation structure within a 4-site deep structure so the quick launch bar is rather clunky to use, but the treeview picks up on document libraries i don't want it to (i only want it to show subsites and pages).

Looking for a way to use a DynamicResource as the source of a binding expression


This is what I've found:

- The DynamicResource MarkupExtension returns a ResourceReferenceExpression which, when assigned to a dependency property of a dependency object that is part of the visual or logical tree, will be invalidated and updated when a resource with the matching key is added to the tree.

- A binding expressions Source property is not a dependency property

- A binding expression is not part of the visual or logical tree when used as a markup extension (or even assigned via property syntax)


My goal is to have something like the following:
<TextBlock Text="{MyBinding Key=SomeResource, Path=Some.Resource.Path}" />

The resource wouldn't be assigned until after the XAML is loaded.

Wouldn't it be reasonable to have my custom markup extension return a derived type of ResourceReferenceExpression, which could do the dirty work. I see a few possibilities, perhaps even something with a custom value converter that could be leveraged to create a binding expression to the value that gets returned when the expression is evaluated?

Any plans to allow this kind of extensibility (or if anyone knows if deferred binding to property paths will be added)?

Can't seem to get into or extend the classes that make this stuff tick. Any ideas? (yeah.. I'm probably jumping all over the place,

Data view web part: Change Data Source

I have a data view web part that I would like to use multiple time in the same page, but tied to different sharepoint lists.  Is there an efficient way to do this?

I can add additional data sources, but I don't see how I can remove the original.

Dynamic data source for Data Form Web Part



I am using a data form web part which is using a rest service to fetch data from the List. Now my List is having different Views, and i want depending on a certain parameter can we make the datasource to fetch data from different views.

Any help is highly appreciated.



Value Converter Without Binding On Image Source


I need to get the path of an image through a value converter. However I can't find any examples of using a value converter without binding.

I would be looking to do something along these lines:

<Image source="{Value=Image1, Converter={ImageConverter}}" />

The image converter will then go check an image folder and return the correct file path.

Binding a DVDropDown control to a XML data source


I'm having a heck of time figuring how to get my DVDropDown control to display items from the SoapDataSource (SOAP web service) or XmlDataSource (REST).


If I create a data view for the same data sources, I can see the data just fine, but when I go to Data Fields dialog, I can select the data source in the dropdown but in all cases, the two other dropdown to pick the value and display text are blank and there's nothing for me to select though I know there should be columns available for selection.


I've also tried manually coding those parameters, accounting for the possibility that I may need fully qualified XPath to get to the column itself but that causes an error.


What could I be missing?



Binding Source and DataGridView not talking

I have on a form a bindingsource, a dataviewgrid, a bindingsourcenavigator, a tableadaptor and a few textboxes linked to the


I need to be able to change the data using a query.

I have the following code which is generated when i select inactive or active for example:

Dim connString As

Binding several widgets to one source


I'm in the proces of learning WPF.

I've reached the chapter about data binding wich is quite brief in the book I'm using. The chapter touches data binding with xml ADO.NET LINQ but, it doesn't talk about binding more the one widget to the same source.

For example:

I have a very simple xml file containg:

  <title>De verloofde van sado</title>
  <id>Amelie Nothomb</id>


And the following xaml code:

<Window x:Class="WPF_xmlprovider2.MainWindow"

Data View Web Part, update to Data Source / adding new list to existing data source


Hi all,

I have four Lists with identical columns :

List 1
List 2
List 3
List 4

I had to merge them, hence i created a data source ( Linked Source ) and merged these lists in SPD. I have used a data view webpart to display some columns from the merged lists data source and everything was working fine.

But now i have a new List : List 5 which also has the same columns like the other four lists and i need to update the data soure such that it is merged list of 5 lists not 4.

i updated the datasource property of the linked source to merge this new list as well. However the contents of List 5 dont appear in the data view webpart. 

Am i missing something here ? 

I dont want recreate the data view web part from scratch eachtime , because in future there might be List 6 , List 7 as well ... 

RSSAggregator Web Part when the source URL is not found


Hey all,

Bit of a longshot with this post, but i'm using an RSSAggregator Web Part on my site. When the URL it refers to can't be found however the little javascript 'loader' bar just stays there, bouncing from side to side - is there any way I can make it display a meaningful error condition?



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend