.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

Adding, removing or editing the items of combobox.....

Posted By:      Posted Date: September 05, 2010    Points: 0   Category :WPF
Hello everyone, I am working on this application which requires Items of the combobox added, edited or removed by the end user in the different section of the application such as settings window or something like that. I guess If we bind the Combobox to the database where we could easily add , remove or edit the items of combox but for the application that doesn't use database that creates a lot of overhead. To demonstrate that Here is my sample application Window1.xaml <Window x:Class="MySampleApplication.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" Title="Window1" Height="300" Width="300" xmlns:local="clr-namespace:MySampleApplication" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"> <Window.Resources> <local:StringsLenToBooleanConverter x:Key="mvc"/> </Window.Resources> <Grid> <ComboBox Height="26" Margin="12,75,12,0" Name="comboBox1" VerticalAlignment="Top"> <s:String>Red</s:String> <s:String>Blue</s:String> <s:String>Green</s:String> </ComboBox> <Button Height="28&quo

View Complete Post

More Related Resource Links

Adding new items to a Repeater control with transitions?



I am currently in the process of writing a facebook type 'activity feed' for a site. Currently I am binding the last 10 items to a repeater control, which contains a usercontrol representing each item. This works fine but there are a couple of requiremnts that are giving me problems and wondered if the the good people of the forum could make some suggestions.

The requirement is that when a user clicks a refresh button any new events are added to the top of the list, the previous items drop down and the equivalent number of old items drop off the bottom, all with nice slider transitions.

I have put the repeater inside of an update control and are able to handle the transitions by using RegisterStartup script to drop jquery calls onto the page for the slider. However I cannot find a way to dynamically add or remove new datarows to the repeater. I need the old items to stay in the repeater and be pushed down by the new items, so completely refreshing the datasource seems like a bad idea.

I was thinking about maybe storing the datasource in the viewstate and adding rows to that, maybe with an extra column on the end which stores what transition is needed on the databind for my jquery, but there will be a 'View more items' link at the bottom of the page, so I am worried that the list could get pretty large and there

Way of adding items in Drop Down List or List Box using Javascript

The article Way of adding items in Drop Down List or List Box using Javascript was added by raja.s on Sunday, June 06, 2010.

Hi,script type="text/javascript"> function AddItem(Text,Value) { // Create an Option object var opt = document.createElement("option"); // Add an Option object to Drop Down/List Box document.getElementById("DropDownList"

Video: Adding SharePoint 2010 Project Items to a C# or VB.NET Project

Each project is either a C# or VB.NET project that contains particular initial project items. In addition Visual Studio 2010 includes SharePoint project items that you can add to any of your projects. (Length: 18:53)

Adding items to ObservableCollection via DataGrid

Hi All, I have a DataGrid bound to an ObservableCollection. I'd like to be able to add objects to the collection via the Grid. When I was working with sample data, I could go to the bottom of the grid, hit enter and add a new entry. Now that I'm using real data I don't seem to be able to do that. I tried taking a look at the class that the SampleData creates and can't quite fathom what it's up to. Does anyone know what I'm missing \ what I need to implement to make this possibe? Thanks Warrick

add a line separator between combobox items using C#.net

i wanna to add a line separator between combo box items using C#.net. how can i do...

Expand the combobox and its items when it gets focus

Hi, I want to expand the size of the combobox whenever the combobox gets the Focus. I have used the following code to expand the combobox height. <Style TargetType="{x:Type ComboBox}">     <Style.Triggers>         <Trigger Property="IsKeyboardFocusWithin" Value="True">             <Setter Property="RenderTransform">                <Setter.Value>                    <ScaleTransform ScaleX="1" ScaleY="2" />                </Setter.Value>            </Setter>            <Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>             <Setter Property="Panel.ZIndex" Value="99999"/>         </Trigger>     </Style.Triggers>  </Style>   Problem: When i put the focus on the Combobox first time, the combobox item list opened in normal mode. But if i again click on the combobox then combobx item list opened and also list items are expanded. But i want the combobox list item

In a group calendar, can items be made visiable to all users by default without adding them as atten

Well the title says it all really. We have a functioning sp 2010 site, setup this weekend, that's working great so far.  Primarily its being used for the company manual and procedures (a wiki site).  Search is working well and so on. I added a calendar with the intention of showing key company activities, plus holiday information and who's out at meetings.  We're a small company and this is unlikely to get ridiculously except on exceptional days. As it stands, when i create an item (for example someone out for a weeks holiday) unless another user adds one of the 'attendees' of the holiday event to the calendar it doesn't show up.  If I add all users as attendees then they can all see it by default. However, if I show that our chairman is attending a meeting at a client, then I can't explicitly say that the chairman is an attendee because for everyone to see it, they have to be attendees as well. I nsoed around a little and thought target audiences might be the way to go.  I configured all users and manager relationships, compiled the audience (it shows the right number of users).  However, if I setup a meeting with the chairman as an attendee, and the whole company audience as the target audience, then people still can't see it. Back to square one. So, is there an actual answer to this?  A different type of calendar, a query that

WebConfigModifications.Remove() is adding instead of removing

I implemented the FeatureDeactivating event just like the activated event except I used the Remove() method instead of Add(). From all the articles I found this is what you're supposed to do, but perhaps I'm missing something.  I also tried removing all modifications for a specific owner, which resulted in duplicating every modification that owner made.  Everything seems to suggest that the Remove() method is actually adding entries. Here is my code, can someone tell me if I've done someting wrong or if this is a bug? using System; using System.Runtime.InteropServices; using System.Security.Permissions; using Microsoft.SharePoint; using Microsoft.SharePoint.Security; using Microsoft.SharePoint.Administration; namespace Sample.Features.Feature2 { [Guid("3eac000f-333d-4ee2-a961-2eda341b6c66")] public class Feature2EventReceiver : SPFeatureReceiver { public override void FeatureActivated(SPFeatureReceiverProperties properties) { // Create a configuration object SPWebConfigModification config = new SPWebConfigModification(); config.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode; config.Owner = "Sample"; config.Name = "WorkflowService[Class='ClassLibrary1.CustomService']"; config.Path = "configuration/SharePoint/WorkflowServices";

Dropping and linking multiple items within the same editing scope transaction

Hi, I'm using IActivityTemplateFactory.Create to provide a custom experience when the user drops a toolbox item onto my Flowchart designer.  The implementation of IActivityTemplateFactory.Create is to use the model item tree to programmatically create multiple model items (related to activities), and link them together using the appropriate model item properties and connector view state.  All this works fine except for one thing. Say I'm dropping three activities as a result of IActivityTemplateFactory.Create.  I want the first activity to appear at the top, underneath should be the second activity and below that the third activity.  I want all three activity designers to appear alighned around their center point and there to be a straight, centered connection arrow between activity one and two and another straight, centered connection arrow between two and three.  Here's some ASCII art (we'll see how the formatting is retained - not very well it seems): |-----------------| | Activity 1 | | | |-----------------| | | | \/ |--------------| | Activity 2 | |--------------| | | | \/ |----------| |Activity 3| |----------|  It's important to note that the activity designers all not all the same size; both the height and width can vary. I've written code that looks at the various activity

Adding new rows to Datagrid with a Combobox column generate "two-way binding requires path or xpath"



    I have datagrid control with a template combobox column like:

 <DataGridTemplateColumn Header="Fault code" Width="75">
                                    <TextBlock Text="{Binding FaultCode1}" />

IE9, Site Specific Browsers, and adding your own Jump List Items to Pinned Tabs

Site Specific Browsers aren't a really new idea. In 2005 there was an app called Bubbles I ran for a while that would let you run a website with minimal "browser chrome." Mozilla Prism (né WebRunner) is a Firefox add-in that does a similar thing. Google Chrome includes the idea of Application Shortcuts. The idea of all this is that some web apps are really applications and you think about them as applications. For me, I think of Gmail and Facebook and Twitter and Basecamp as applications not necessarily as browser tabs. The notion of Site-Specific Browsers is definitely arriving. Internet Explorer 9 Beta (IE9) is out now and includes a featured called " Site Pinning " which is a effectively Site Specific Browsers. It's...(read more)

Problem when adding items to a listbox from different threads


I have an application in which different threads add items to a listbox throughout the application's execution (not at startup). But when one of the threads tries to add an item to the listbox, a System.InvanlidOperationException is thrown and the error message is: "The calling thread cannot access this object because a different thread owns it." (In my scenario the "calling thread" is one of the worker threads that add items to the listbox, and the "different thread" is the UI thread.)

So basically I just need a simple way to allow the threads to share the listbox object, or, failing that, some other workaround.

Adding Items to ListBox with animation



I have the following code:

<DataTemplate x:Key="DataTemplate1">
		<EventTrigger RoutedEvent="FrameworkElement.Loaded" SourceName="textBlock">

" 'System.ArgumentOutOfRangeException' occurred in PresentationCore.dll " while adding items to Ob

I have custom workflow designer in wpf application.
So there is a toolbox with activities.
I have collection of toolbox items in toolbox:

public ObservableCollection<WorkflowToolbox> Items
            get { return (ObservableCollection<WorkflowToolbox>)GetValue(ItemsProperty); }
            set { SetValue(ItemsProperty, value); }

// Using a DependencyProperty as the backing store for Items.  This enables animation, styling, binding, etc...
 public static readonly System.Windows.DependencyProperty ItemsProperty = System.Windows.DependencyProperty.Register("Items", typeof(ObservableCollection<WorkflowToolbox>), typeof(WorkflowToolboxContainer), new UIPropertyMetadata(new ObservableCollection<WorkflowToolbox>()));

Then every time i close/open that component in UI this collection  is cleared and populated with new items.

WorkflowToolbox toolBox = new WorkflowToolbox { DataContext = assembly };

And after 2 open/reopen i had ArgumentOutOfRangeException with stack trace:
   at System.Windows.Me

Dropping and linking multiple items within the same editing scope transaction - Part 2



In an earlier forum post, I asked about how to drop multiple items from the toolbox onto the design surface, have them arranged nicely, and do all this in a single editing transaction.  In that post, Kenny came up with a nice solution.

There's one more scenario that I didn't discuss in the earlier post, that I was hoping to be able to resolve on my own after getting the other post answered.  But, I I'm afraid I need some more help.

The scenario is the same as in the earlier post with one additional complication.  One of the items I'm dropping as part of the drag/drop operation is a FlowSwitch node.  If I did nothing else, the solution presented in the earlier forum post would work.  However, I've an additional need to visually change the appearance of the FlowSwitch designer. Normally, one can change an activity's designer (even a built in activity) by using the metadata store.  However, the FlowSwitch is unique in that the Flowchart designer has hard-coded knowledge of the FlowSwitch designer, and if you replace the built in designer via the metadata store, there are numerous places where the Flowchart designer will generate exceptions and pop up error messages.  I also have the need t

Strategies for removing empty list items from a listview upon render?


using asp.net 4 and vs 2010

I have a listview that displays data from a database. I have to configure it to display all column data where present, however, not all columns have data, with the result that blank spaces get rendered where this data would normally be displayed.

The code:

<asp:ListView ID="lvNationalCouncillor" runat="server" DataKeyNames="PersonId">
          <h2>National Council Contacts</h2>          
            <asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>            
          <div class="ContactWrapper">
          <div class="ContactText">
          <h3><%# Eval("Title") %></h3>
          <br />
          <li><asp:HyperLink ID="BioLink" runat="server"
           Target="_blank" Text='<% #Eval("Name")%>'
           NavigateUrl='<%#"~/Biography.aspx?PersonId=" + 
              Eval("PersonId") %>' />

Adding Items to existing list using CAML

Does anyone know how to add list items (not files) to a SharePoint list using CAML?  I know how to do this in code but I was curious if it was possible in CAML. We can add files using the Module element quite easily and so I thought, why not list items?  It is possible to add list items to a new list using the Data element, but I am trying to add items to a list created earlier by another feature.
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