Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 23:47

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



wpf zugriff auf listbox

Discussion on wpf zugriff auf listbox within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1

 
Singleplayer™'s Avatar
 
elite*gold: 3
Join Date: Feb 2016
Posts: 1,291
Received Thanks: 321
wpf zugriff auf listbox

Moin,
Da ich bei google bisher nichts finden konnte frag ich einfach mal hier.

und zwar hab ich das problem , das die listbox angeblich nicht im kontext enthalten ist, bin es halt gewohnt durch windows form , das man einfach name.items.add() macht und dann hat sich die sache erledigt geht aber in dem fall irgendwie nicht

hier noch der code part , auch wenn der eig egal ist , da ich ja schon sagte habs wie winforms aufgebaut ...
Code:
string fullPath = theDialog.FileName;
                        string[] lines = File.ReadAllLines(fullPath, Encoding.UTF8); ;
                        foreach(string line in lines)
                        {
                            combolist1.Items.Add(line);
                        }
#edit
hab den fehler letztendlich doch gefunden , wusste nicht das wpf so nervig ist und man sogar noch den datasource binden muss...

für alle die das selbe problem haben hier die lösung:

Singleplayer™ is offline  
Old 04/13/2020, 16:05   #2
 
elite*gold: 25
Join Date: Jun 2013
Posts: 151
Received Thanks: 13
Noch eine kleine Bemerkung

Der Kontext wird separat gebunden, da WPF für ein MVVM Pattern ausgelegt wurde.
→ View, Logik & Datenzugriff sind in getrennten Klassen, "Code-Behind" sollte nicht mehr angewendet werden


Das XAML (View) würde etwa so aussehen:
Code:
<Window.DataContext>
        <local:ViewModel/>
</Window.DataContext>
<Grid>
        <ListBox ItemsSource="{Binding FileObjectCollection}" 
		SelectedItem="{Binding SelectedFileObject}"/>
    </Grid>


Die Logik (ViewModel) würde etwa so aussehen:
Code:
#region SelectedFileObject
        private FileObject selectedFileObjects;
        public FileObject SelectedFileObject
        {
            get { return selectedFileObjects; }
            set
            {
                if (value != this.selectedFileObjects)
                    selectedFileObjects = value;
                this.SetPropertyChanged("SelectedFileObject");
            }
        }
        #endregion SelectedFileObject

        #region FileObjectCollection
        private ObservableCollection<FileObject> fileObjectCollection;
        public ObservableCollection<FileObject> FileObjectCollection
        {
            get { return fileObjectCollection; }
            set
            {
                if (value != this.fileObjectCollection)
                    fileObjectCollection = value;
                this.SetPropertyChanged("FileObjectCollection");
            }
        }
        #endregion FileObjectCollection
SturTex is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[Hilfe] FreeBSD kein zugriff als root / kein FTP zugriff
03/25/2012 - Metin2 Private Server - 5 Replies
Hallo Community, ich beschäftige mich jetzt seit 3 Stunden mit einem Problem auf meinem FreeBSD-Server. Ich Installiere FreeBSD über die .iso in Virtual box und wen es installier ist Loge ich mich mit root ein. Dann aber habe ich mit root keinerlei Zugriffsrechte. Ich kann als normal angelegter User auf den FTP Server zugreifen aber als root nicht. Und ich kann nicht in /etc/ssh/sshd_config die Einlogrechte ändern weil dann Permissen denied kommt. Bitte um Hilfe mein Skype: passilp Ich...
Ibot 1.8.5 with configured WPF - cracked
05/22/2011 - Browsergames - 34 Replies
Hey, 2.7 - geht nimmer - not working 2.8 - müssen warten für crack - still waiting for a crack ;) So, here a fix tutorial for working ibot 1.8.5
WPF New
11/15/2008 - Lin2 Exploits, Hacks, Bots, Tools & Macros - 0 Replies
new WPF 658F WPF No Comments
Problems with WPF
06/11/2008 - Lineage 2 - 0 Replies
So i wanna set up my WPF for a new server L2 Rapture (interlude). But i have a problem, im a noob :D . I know the login IP: mayhem.com port: 2106, and the server IP: mayhem.com port 7777. So how can i set that up in WPF ? If any1 could take the time and explain that to me would be great :D Tnx in advance.
Wpf
08/10/2007 - Lineage 2 - 0 Replies
Hello guys :) Can someone tell me how this wpf program works ? Wpf is used to find the token of a server . btw if someone knows another program post it here <hr>Append on Aug 11 2007, 12:50<hr> guys i really need help I'm trying to find the token 1-2months now but i cant This is the server



All times are GMT +1. The time now is 23:47.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.