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

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

Selecting One Checkbox Control In DataGrid Control Using MVVM Using Silverlight

Posted By: Asim Sajjad     Posted Date: July 18, 2011    Points: 2   Category :Silverlight
In this post I will show you how to select single check-box control when you have single check-box control in each row of the datagrid control. As you all know that check-box controls are normally used for the multiple selection and radio buttons are used for single selection. But there are sometimes requirement that control should be check-box and selection should be single. Mean if user view data in the datagrid control then he/she should only select one check-box at a time not more then one. Main page is shown in the Image 1. Here you can see that I have placed check-box control in the first column of the datagrid control which I have also highlighted.

View Complete Post

More Related Resource Links

A datagrid control that can be personalized... anyone??


Hello all,

I need a datagrid control that has following features, besides other regular stuff like paging, sorting, filtering, etc:

The user should be able to -

1. Select columns to view

2. Select column Sequence

3. Select default sort column

4. Store the setting (as a view) and use it on next visit.

5. llow multiple such views to be stored for a user for future use.

All these settings should be saved and when the user comes back he gets the same settings.

Really appreciate your time and would love to get any ideas.


- Zen

how to get the text of selected checkbox from asp.net checkboxlist control using jquery


I have asp.net checkboxlist control that bounded to a data source so the number of items in the control are different from one to to another time.

I have this function:

     $('#<%=chkListGroups.ClientID %> input:checkbox:checked').siblings('label').text();

this function will return all texts for all selected items in the control as a one string.

 I'm looking for a way that when I check a check box from the ckeckboxlist control will return only last checked checkbox.

this code :

$('#<%=chkListGroups.ClientID %> input:checkbox:checked').last().siblings('label').text(); 

returns last checked item for example if I checked second will return
second item then when I checked fifth item will return fifth item but
if now when I check third item will return fifth item so it is always
returning last item checked in the list and I'm looking to

Please advice me how to do this using jquery.

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 ---

How to Bind a child control with properties of the parent control in Silverlight and WPF?

Dear Experts, I have a usercontrol in Silverlight and I want to enable the update button inside the usercontrol with property defined in the usercontrol. For the proof of concept sake I have defined the usercontrol xaml and the code behind in VB.NETBelow is the XAML and VB.NET Code. ----------------------------------------------------------------------- <UserControl x:Class="SLBAppAssementQuestions.SilverlightControl1"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"     mc:Ignorable="d"     d:DesignHeight="300" d:DesignWidth="400">     <StackPanel>         <CheckBox x:Name="chkBox1" Margin="10" Checked="chkBox1_Checked" >Checkbox1</CheckBox>         <CheckBox x:Name="chkBox2" Margin="10" Checked="chkBox2_Checked">Checkbox1</CheckBox>         <Button  x:Name="BtnUpdate&q

Using MVVM with new Ribbon Control Library

Hi, As new ribbon for wpf http://www.microsoft.com/downloads/details.aspx?FamilyID=2BFC3187-74AA-4154-A670-76EF8BC2A0B4&displaylang=en is officially released, I am looking for a way to use new ribbon control library in my application respecting the MVVM pattern, I used ribbon 2007 repecting MVVM by extending the RibbonCommand with CanExecute and Exceute properties, but Microsoft has dumped RibbonCommand in new release. Any help on new Ribbon with MVVM is appreciated.

Silverlight media player control for mvc

I wamnted to add a silverlight media player to my MVC site. there was a silvlight Media player that you could drag and drop on a page from the tool box, but I cant find it anymore. I am not sure it was good for mvc anyhow,   what is the easiest way to get a silverlight media player up and running on a mvc site, I really dont want to make my own, incorarating a silverlight app just for the media playerr seems like a fair bit of work, i was really looking for the drag and drop option we had in VS2008  I'm using VS2010 .net 4 silverlight 4 Any ideas?

Building a user control with MVVM

Hi there, I created a custom user control that retrieve rows from database and will create all the buttons on runtime. My current approach is write all codes in the code behind of user control. And also I add a click event handler to each buttons that created on runtime. When any of the button is clicked, inside the click handler function will raise a RoutedEvent. And at the parent control, I add a handler to the custom user control to handle which button is clicked. The problems is : 1) I don't want to write all codes at the code behind. I tried to create a view model class for the user controls, but I failed to bind the event to view model as I wanted to retrieve the object that call this event. ICommand doesn't provide the information for it. 2) Even if I successful created a view model class, when a click event is triggered, the view model will handle it then it fire another event to user control class then the user control class fire another event to the main parent control. Which I think this is stupid >_< 3) I want to know how to user MVVM in this situation. Thanks & Regards, Rambo Ong

Problem in tab control with MVVM Pattern

Hi,  Am new to wpfpatter and mvvm also. I have problem, i need to assign the same shortcut key(say alt+N) to two button in different tab. i have used the following code to assign the shortcut. problem in when i click the shortcut key in tab one it will get trigger the tab two button event. --xmal code is     <UserControl.InputBindings>         <KeyBinding Command="{Binding Path=Delete1Command}" Modifiers="Alt" Key="N"></KeyBinding>         <KeyBinding Command="{Binding Path=Delete2Command}"   Modifiers="Alt" Key="N"></KeyBinding>     </UserControl.InputBindings>        <TabControl  Height="100" HorizontalAlignment="Left"  Name="tabControl1" VerticalAlignment="Top" Width="200">             <TabItem Header="tabItem1" Name="tabItem1">                 <Grid>                     <Button Content="Button1" Height="23&q

Using DataGrid for my application - is it the right control?

I've been investigating DataGrid for my embedded application.  Basically, what I want to do is to read in information from my embedded system over USB.  Store the information in a structure.  And, retrieve the information from the structure to display to the user.   The information I want to display is an ID Number (1-255), an ID Description, and a Relay Number.  The Relay Number is a drop down combo box with 4 options of 1-4, which is editable by the user.  The ID Number is not editable and the Grid should contain information all 1-255 IDs.  The Description should be a maximum, editable, field of 30 characters (I might change later).  Is the DataGrid the best way to do this? I tried to implement a DataGrid (see below), but am having some problems getting the data into the columns correctly.  Do I need both the Header entries in WPF and in the code?  When I do, I get two columns of 'ID #' and 'IDNum' with 1-255 in each column.  I don't want the header 'IDNum', only 'ID #' as stated in the WPF code.  I'm missing something.  Maybe someone can help.  Thanks. Sutton     <DataGrid Height="287" HorizontalAlignment="Left" RowHeight ="20" Margin="12,96,0,0" VerticalAlignment="Top" Name="PointZoneDataGrid" DataContext="{Bi

Binding ListView Control Using MVVM

In this short post I will show you how you can bind the list view control and get the selected value of the list view control using MVVM pattern. For this post I have added one list view control which hold the grid view control in it view and when item is selected in the grid view the selected item is shown at the end of the screen. In the Image 1the selected items are not shown ( only the label fields are shown) but in the Image 2 when user click on any of the item the detail is shown.

BackgroundWorker dont works starting an user control on MVVM



I have a problem using backgroundworker object.

If I use a code to load with Entity Framework a SQL table for fill a combobox, the program takes a lot of time and user experience is bad.
If I use a backgroundworker object, simply the combobox is'nt filled; my MVVM class that have a public property ObservableCollection<MyRecord>. I debug the code and this collection is filled right but WPF appears dont know that collection is recently filled. I try to use on Source property of combo the OneWay and TwoWay attributes, but dont work

I'm sure that any thing do it bad ¿Any body can tell me where try to fix up the problem?

    Private Sub LoadCountries()

'This code works fine, but user experience is affected
      'Me.Recursos = New ObservableCollection(Of Recurso)(Application.Contexto.Recursos.Include("User"))

      Using worker As New BackgroundWorker()

        Dim p As System.ComponentModel.DoWorkEventHandler =

Dropdown control issue while selecting the value in IE8.



I am facing an issue while selecting a dropdown list value in IE8.

In IE8, while selecting the item in the dropdown list, the control goes out of focus immediatley when clicked for the list of items to select.It makes very hard for the user to select the value from dropdown list.

This dropdown control has some CSS settings enabled for it. I am not sure if this is an issue.

Any suggestions/ideas on this issue.








MVVM: How to bind a page in a tab control with a viewmodel?

We practise MVVM pattern.
We have a main window which contains tab controls. Each tabItem contains a page.
Since the main window needs to share some data with one of page, so our MainWindowViewModel creates the instance a RunconditionViewModel.
Then we need to set the instance of RunconditionViewModel to one of page's DataContent (page called ControlPage.xaml).
How do we achieve that? see the code below.

In HDMainWindow.xaml,
<TabControl x:Name="tabControlMain" DockPanel.Dock="Left" MinHeight="200"  SelectedIndex="0" TabStripPlacement="Left" >
<TabItem Header="Run" Name="TabItemControlPage"> <Frame Name="FrameControlPage" Source="Features\Basic Control\ControlPage.xaml"></Frame> <!--<Frame Source="Features\Basic Control\LoginPage.xaml"></Frame>--> </TabItem> in App.xaml.cs,

protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); InitializeComponent(); HDMainWindow hd = new HDMainWindow(); HDMainWindowViewModel hwd = new HDMainWindowViewModel(); hd.DataContext = hwd; //if (hd.TabItemControlPage != null) // hd.TabItemControlPage.DataContext = hwd.RunConditionsViewModel; if (hd.FrameControl

e.Result in selected vs selecting event of linqdatasource control



in the selected event it seems even though e.TotalRowCount really is the total row count, when I cast e.Result to a type in order to access the actual data only the current page of data is there? not all.

IEnumerable<InventoryGridItem> items = (IEnumerable<InventoryGridItem>)e.Result;

items only has the 15 records for the current gridView page, not all the records, is this normal? If I need to access all the items in the result do I need to stick with the selecting event instead? 

Expand control with DataGrid in wpf


i have a problem,

iam using a datagrid and in datagrid every row has a expander control with mentain a comments. my problem is whenever i expand that time datagrid is also expand and again whenever i collapse then some space is meintain in bottom of datagrid how can i solve this.

another thing is that iam using a datagrid.Items.Refresh(). but when datagrid refresed comments is also clear...plz give me a solution immediately

Silverlight user control, canvas "layout root", no key events ever.



I'm trying to use a UserControl in Silverlight and I want to handle some key events. The user control is a network diagram, laying out data points in a circle and showing the relations between points. It consists of a canvas to which various shapes (ellipses for data points, lines for relations between points). I'd like it to be focusable and receive mouse and keyboard events to add support for things like rotation, scaling, and randomizing the layout of data points (how readable the diagram is depends on the data and where in the circle related data points are located, but I'm not going to attempt any smart layout logic that figures out where to put the points; instead, I simply allow the points to be laid out in random order along the circle); I was thinking F5 (with it's "reload/refresh" connotations) would be a neat key for this.

Trouble is, I am never ever receiving any key events. Mouse events apparently do bubble up to the canvas, but only from labels - the data points have labels - so I can handle them there. Currently this allows me to resize and rotate the diagram by scrolling the mouse wheel (with the shift key down to rotate, without to scale) if and only if the mouse cursor is over a label. Not *quite* what I want!

After some quick googling I've attempted to set IsTabStop to true on the UserControl containing the Canva

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