Click here to Skip to main content
15,884,986 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Resource dictionary Pin
Kunal Chowdhury «IN»20-Apr-11 22:37
professionalKunal Chowdhury «IN»20-Apr-11 22:37 
Questiondialogs must be user-initiated silverlight 4 Pin
NTheOne18-Apr-11 1:24
NTheOne18-Apr-11 1:24 
AnswerRe: dialogs must be user-initiated silverlight 4 Pin
Pete O'Hanlon18-Apr-11 2:00
mvePete O'Hanlon18-Apr-11 2:00 
GeneralRe: dialogs must be user-initiated silverlight 4 Pin
NTheOne18-Apr-11 18:53
NTheOne18-Apr-11 18:53 
AnswerRe: dialogs must be user-initiated silverlight 4 Pin
Abhinav S22-Apr-11 8:30
Abhinav S22-Apr-11 8:30 
QuestionImage control not getting resized while resizing window Pin
DavJes18-Apr-11 0:33
DavJes18-Apr-11 0:33 
AnswerRe: Image control not getting resized while resizing window Pin
DavJes18-Apr-11 0:34
DavJes18-Apr-11 0:34 
QuestionHow to check duplicate data in listbox.itemtemplate Pin
Rocky2317-Apr-11 23:44
Rocky2317-Apr-11 23:44 
Hi,

Can anyone tell me how to check the duplicate data is present in listbox itemtemplate..

i have listbox, where i need to check whether the data enterred by the user in textbox is duplicate or not, how to do it..

my code is like this..

<ListBox x:Name="lbDirectiveList" MaxHeight="200" SelectionChanged="lbDirectiveList_SelectionChanged" SelectionMode="Single" ScrollViewer.VerticalScrollBarVisibility="Auto">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid Margin="4">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto" />
                                            <ColumnDefinition Width="10" />
                                            <ColumnDefinition Width="*" />
                                        </Grid.ColumnDefinitions>

                                        <TextBlock Text="{Binding Path=DirectiveName}" Grid.Column="0" FontWeight="Bold" MinWidth="180"/>                                        
                                        <TextBlock Text=" - " Grid.Column="1"/>
                                        <TextBlock Grid.Column="2" Text="{Binding Path=Descr }" />
                                    </Grid>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>


ObservableCollection<Directive> listdata=new ObservableCollection<Directive>();

 class Directive
    {
        public string DirectiveName { get; set; }
        public string Descr { get; set; }
    }
Directive lstdir=new Directive {DirectiveName=txt1.Text.Trim(),Descr=txt2.Text.Trim()};
void Add(object sender,RoutedEventArgs e)
{
if(!listdata.Contains(lstdir))
{MessageBox.Show("Insert");}
else MessageBox.Show("Duplicate Data");
}


it is taking the duplicate value, after using the above code...
so any help on this...
AnswerRe: How to check duplicate data in listbox.itemtemplate Pin
Abhinav S18-Apr-11 5:03
Abhinav S18-Apr-11 5:03 
GeneralRe: How to check duplicate data in listbox.itemtemplate Pin
Rocky2318-Apr-11 23:03
Rocky2318-Apr-11 23:03 
QuestionBind a UserControl string array property to containing window Pin
Jean-Louis Leroy17-Apr-11 23:08
Jean-Louis Leroy17-Apr-11 23:08 
AnswerRe: Bind a UserControl string array property to containing window Pin
Jean-Louis Leroy17-Apr-11 23:41
Jean-Louis Leroy17-Apr-11 23:41 
QuestionReceiveAsync Issues Pin
veggieCoder15-Apr-11 8:13
veggieCoder15-Apr-11 8:13 
AnswerRe: ReceiveAsync Issues Pin
SledgeHammer0115-Apr-11 10:05
SledgeHammer0115-Apr-11 10:05 
QuestionPRISM in Silverlight Pin
NTheOne15-Apr-11 0:30
NTheOne15-Apr-11 0:30 
AnswerRe: PRISM in Silverlight Pin
Tarun.K.S15-Apr-11 0:59
Tarun.K.S15-Apr-11 0:59 
AnswerRe: PRISM in Silverlight Pin
Pete O'Hanlon15-Apr-11 1:59
mvePete O'Hanlon15-Apr-11 1:59 
AnswerRe: PRISM in Silverlight Pin
Abhinav S15-Apr-11 17:58
Abhinav S15-Apr-11 17:58 
QuestionWPF PopUp control Pin
Rahul Chitte14-Apr-11 1:59
Rahul Chitte14-Apr-11 1:59 
AnswerRe: WPF PopUp control Pin
Pete O'Hanlon14-Apr-11 2:20
mvePete O'Hanlon14-Apr-11 2:20 
AnswerRe: WPF PopUp control Pin
Ian Shlasko14-Apr-11 3:19
Ian Shlasko14-Apr-11 3:19 
AnswerRe: WPF PopUp control Pin
Abhinav S14-Apr-11 3:32
Abhinav S14-Apr-11 3:32 
GeneralRe: WPF PopUp control Pin
Tarun.K.S14-Apr-11 3:50
Tarun.K.S14-Apr-11 3:50 
GeneralRe: WPF PopUp control Pin
Abhinav S14-Apr-11 4:05
Abhinav S14-Apr-11 4:05 
QuestionAnother Dummies question (sorry) Pin
Johnny J.14-Apr-11 0:53
professionalJohnny J.14-Apr-11 0:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.