.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

ICommand implementation : Toggling a whole GroupBox's visibilty (MVVM)

Posted By:      Posted Date: September 05, 2010    Points: 0   Category :WPF
Hi, I have started writing my own custom Command classes by implementing the ICommand interface. So far, it works like a charm when I bind them to Buttons. It's a good thing to let the CommandManager do the work of checking each of my command predicates to toggle a button's visibility, but, what if I want to toggle a whole UI region (like a GroupBox) depending on specific conditions ? A clear example is a GroupBox with a ProgressBar which Visibility is "Collapsed" by default and that I want to be Visible only when the user has completed the minimum requirements on the View. Acutally, I have written a ICommand that verifies if the user has entered all the minimum requirements (selecting at least an item in each of the three ListBox and has entered a valid path in a Textbox. I have bound that ICommand to a Button (which I have called ExportButton). So, when all the requirements have been approved by the ICommand, the Button's visibility toggles to Visible and the user can "Export". My question is : How can I toggle the "Exportation GroupBox"'s Visibility (the GroupBox that contains the ProgressBar) from "Collapsed" to "Visible" when the user has clicked the Export Button ? Of course I could just do it from the Button's Click event in code-behind. In respect to MVVM, I'd like to keep my codebehind file as clea

View Complete Post

More Related Resource Links

WPF: If Heineken did MVVM Frameworks Part 4

MVVM is to have an instance of a particular Model (say currentPerson) inside my ViewModel (say PeopleViewModel) which is exposed to the View (say PeopleView). The View binds and edits the Model directly.

This definitely flies in the face of what most people consider to be the holy grail of MVVM pattern, but it's a fairly new pattern, so people are still finding their way with it every day, and this works for me very well. The reason I do what I do, is for the following reasons:

1.I have always had the luxury of being able to write my own UI specific Model classes. I would even do this if I was using some other Model classes first, such as LINQ to SQL or LINQ to Entity Framework. As these classes don't have everything a proper WPF Model class needs in my humble opinion. Though, they are pretty good, as they are Partial classes and use INotifyPropertyChanged/DataContract etc etc
2.I am a pragmatist and I do not like writing code for the sake of writing code. I have seen some MVVM apps where the author has had a Model with 50 properties on it, that are simply repeated in the ViewModel abstraction, where the ViewModel added nothing. On that day I decided I would never do that unless I have to.
3.I honestly see no harm in writing directly to the Model from the View, JUST SO LONG AS if the Model is InValid its data NEVER makes its way to the database. I honestly see no pro

jQuery Date picker Implementation in ASP.NET

I've posted a wrapper ASP.NET around the jQuery.UI Datepickercontrol. This small client side calendar control is compact, looks nice and is very easy to use and I've added it some time back to my control library.

This is primarily an update for the jQuery.ui version, and so I spend a few hours or so cleaning it up which wasn't as easy as it could have been since the API has changed quite drastically from Marc's original implementation. The biggest changes have to do with the theming integration and the resulting explosion of related resources.

If you want to use this component you can check it out a sample and the code here:

Can I use MVVM for it?


I've read many articles about MVVM, but I can't get it into real code.

I have two lists which have common field user_id. First list contains all users with their names and second all files from all users. The asp.net page should show grid with newest file for every user. How can I get it into MVVM? Where should I bind username to his file? Need I ViewModel for every list or one common for both?


Regards, Gabriel

RSS implementation code - need suggestion


Please suggest what is the best approach of coding for RSS implementation,


Implementation 1:

a) Add custom handler in web.config for .rss type

b) Create a handler class (RSSHandler.cs) in APP_Code

c) Create a Sample.rss file

d) Browse Sample.rss in browser

 Technical Solution:Utility Classes:I)                   

Debug implementation of URLrewriter.net



After some googling and help from the forum, I have integrated the the URLrewrting.net in my project. There are no error when I build the project, but the URL rewriting does not work. I am able to figure ot where the problem is. Is there a way to debug this. The code is as below:

 Web.config file

<?xml version="1.0"?>
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
		<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
			<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
				<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.W

.NET Remoting: Create a Custom Marshaling Implementation Using .NET Remoting and COM Interop


The .NET Framework offers several methods for customizing the presentation of native .NET and COM object types. One such technique, custom marshaling, refers to the notion of specializing object type presentations. There are times, like when a legacy COM component needs to implement a new interface or when you need to make calls across process or machine boundaries, when custom marshaling saves the day. Elements of COM Interop permit the customizing of COM types while .NET Remoting offers the developer the ability to tailor native .NET types. This article examines these techniques.

Jim Sievert

MSDN Magazine September 2003

Rotor: Shared Source CLI Provides Source Code for a FreeBSD Implementation of .NET


With over 9,000 files, and including some 1300 public classes to pore through, the Shared Source CLI can teach you quite a bit about the internal workings of the CLR. But the sheer amount of source code included can make just starting your exploration a monumental task. This article discusses some of the things you can learn from the source code facsimile of the CLR, like how JIT compilation works. It will also help you understand how to control execution along with debugging and loading classes. A walk through the steps involved in setting up the runtime will let you become familiar with the process.

Jason Whittington

MSDN Magazine July 2002

Prevent Concurrent Logins ? [ Already logged in or currest session is still active implementation] ?


Hi Experts ,

I searched over the web but no luck so far and thought of getting some help form gurus .

Did any out really implemented a way to handle concurrent logins ?

Please not that i'm no using either forms authentication or Roles/Memberships , I do have custom authentication for my website .

I'm sure it is someway related  with global.asax file handling something in application events and session events but unable to figure this one out .

Any pointers will highly be valued and appreciated .

Thanks a tonne in advance .

Toggling of iFrames works fine in Firefox but not in IE


I have different iFrames on my page and one of the iFrame has pdf plugin that shows the PDF document and i have another iFrame that pops up on delete button click and  a function to toggle the iFrames. It works fine in Firefox but in IE my pop up iFrame is always behind the PDF. 
Any thought how can I set it right, there is some issue with the z-index of PDF, it is set to infinity something like that in IE ! 


MVVM Demo App. Josh Smith

I've been studying this code for a while now, taking notes and digging in.  I am an experienced programmer and have been around a while.  Was wondering if anyone else feels that same way I do about this demo..  It's a pretty difficult thing to get your "head around".  Does it seem that the simple thing we're trying to accomplish with the MVVM pattern is really difficult?  Or am I just a newbie to the pattern and eventually it will sink into the thich skull? I don't criticize the work done because as far as I can tell it's a nice piece of work.  All of the Abstract classes are well defined, the concrete classes are well defined, the commanding patterns are very interesting.  It just seems to me that we are jumping through hoops to do this stuff. Comments?Javaman

MVVM with navigation pages

Hi how can i do for create a WPF navigation pages application using MVVM pattern? Thanks

Implementation of Audit Fields and optimistic concurrency

What is the best way to implement Optimistic concurrency? Also, I have 4 audit columns in every table in my database. They are created date, updated date, created by, updated by. Application should populate these fields. I want to know how to populate created date , and updated date? From where application datetime or database datetime? On save button click, if I have to save data into 4 different tables, then I need to have same datetime in all 4 audit fields correct? What is the best way to implement this? What will be the design? Please let me know.  

regex split implementation

hi I have created a function to implement the regex.split in sql. Here's my code: private static IEnumerable<IndexedValue<T>> ToIndexedValue<T>(IEnumerable<T> list) { int idx = 1; foreach (T value in list) yield return new IndexedValue<T>(++idx, value); } private struct IndexedValue<T> { public int Index; public T Value; public IndexedValue(int index, T value) { Index = index; Value = value; } } [SqlFunction(FillRowMethodName = "FillSplit", TableDefinition = "[ID] int, [Value] nvarchar(max)")] public static IEnumerable RegexSplit(SqlString input, SqlString pattern) { if (input.IsNull) input = String.Empty; if (pattern.IsNull) pattern = String.Empty; try { return ToIndexedValue<string>(Regex.Split(input.Value, pattern.Value, Options)); } catch { throw; } } public static void FillSplit(object obj, out int id, out SqlString value) { IndexedValue<string> iv = (IndexedValue<string>)obj; id = iv.Index; value = iv.Value; } However when i try it i get id values but empty text values. Can someone help?

Global Values in MVVM

When developing WinForms app, I created in the Program.cs module a singleton instance of a class that held values that I could reference anywhere in the application.  The values included connection string (the user could log onto anyone of a number of databases), various options from the database including information about the user, etc. Any recommendations about how to do this within the scope of the MVVM pattern for WPF?  

MVVM and Animation Control

I've been struggling with what should be a fairly straightforward issue...hoping someone's got a solution.I'm using MVVM in a scenario where I'm using a MediaElement in a View. The MediaElement has a Storyboard that I customize using DataBinding. The scenario works well when I'm using EventTriggers to control playback, but I have not discovered how to manipulate things using DataTriggers.My Storyboard consists of a ParallelTimeline, which contains the MediaTimeline (with Source, BeginTime and Duration databound to the ViewModel. I've got two buttons that are attached to the Storyboard in EventTriggers calling PauseStoryboard and ResumeStoryboard. This works well, but it's not the best paradigm for me.I am trying to accomplish a design where, if I have two such Views each containing a MediaElement with this type of Storyboard, when one Storyboard reaches its end point, the other View's MediaElement is triggered to play.I have tried to use a DataTrigger design, but I am having problems freezing the Storyboard because I'm using DataBinding to set some of the Storyboard parameters.Does anyone have any ideas as to how I can control a MediaElement via Storyboard/Timeline using DataTrigger instead of EventTrigger? Am I missing something obvious in MVVM?--- Jim ---
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