עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

שאלה ב WPF איך אני מחבר באמצעות DataContext...

Featured Replies

פורסם

ב"ה

איך אני יכול לקבל את מה שהוקלד בפקדים TextBoxשנמצאים ב StackPanel שמחוברים ע"י Binding

תיאור:

יצרתי StackPanel שמכיל פקדים שונים בעיקר TextBox אבל נתקלתי בבעיה שאני לא יכול לאסוף את הנתונים שהוזנו לקלאס שיצרתי

לדוגמה כדי לשלוח להם נתונים אני עושה את זה ע"י StackPanel.DataContext = MyData

אבל ביצוע פעולה הפוכה אני לא מצליח לעשות

אני לא מחפש פיתרון של התייחסות לכל תיבת טקסט בנפרד ז"א להגדיר שם לתיבה וע"י זה להתייחס אליה בקוד.

תודה

פורסם

אתה צריך לעשות BINDING דו כיווני

דוגמא(ממיקרוסופט)

<TextBox Width="248" Height="24" Text="{Binding ElementName=lbColor, Path=SelectedItem.Content, Mode=TwoWay}" x:Name="txtSelectedColor" Background="{Binding ElementName=lbColor, Path=SelectedItem.Content, Mode=OneWay}"/>

פורסם
  • מחבר

כן אבל איך אני אמור לקבל את הנתונים בקוד

אין אפשרות לעשות MyData = StackPanel.DataContext

??

פורסם

אין צורך לבצע השמה מכיוון שהBINDING מוודא שהם תמיד קשורים

פורסם
  • מחבר

תודה.

הבנתי את הרעיון

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.