עבור לתוכן
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.

ItemsControl - WPF

Featured Replies

פורסם

יש לי טבלה בבסיס נתונים (עם 3 עמודות string,int,int), ואני רוצה להציג אותה על המסך לא בצורת GRID,

אלא- בעיצוב של LABELים וקוים מפרידים.

איך עושים זאת באמצעות ItemsControl?

פורסם

את יכולה ליצור ItemTemplate


<ItemsControl.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock Text="{Binding Path=FirstProperty}"/> <TextBlock Text="{Binding Path=SecondProperty}"/> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate>

כש- FirstProperty ו - SecondProperty הם Properties ב- DataContext של הItemsSource של ה- ItemsControl שלך.

זה משהו די בסיסי ב-WPF, כדאי שתעברי על הנושא הזה מהבסיס.

פורסם
  • מחבר

OK.

יצרתי את הITEMCONTROL, ואני רוצה שהSTACKPANEL עם הנתונים יסודר בWARPPANEL (כלומר - כשמתמלא טור , יתחיל טור חדש).

רשמתי:

 <WrapPanel Grid.Row="2" Height="390" HorizontalAlignment="Left" Name="wrapPanel" VerticalAlignment="Top" Width="734" Orientation="Vertical" > <ItemsControl DockPanel.Dock="Top" Name="itemControlGrid" Grid.Row="2" > <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Vertical"/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel Height="30" Name="stackPanel3" Width="360"> <Grid Height="25" Width="360"> <Grid.ColumnDefinitions> <ColumnDefinition Width="206*" /> <ColumnDefinition Width="65" /> <ColumnDefinition Width="65" /> </Grid.ColumnDefinitions> <Label Content="{Binding Path=SugTeur}" Style="{StaticResource labelStyle}" /> <Label Content="{Binding Path=Count1}" Grid.Column="1" Foreground="#FF2F76C1"/> <Label Content="{Binding Path=Count2}" Grid.Column="2" Foreground="#FFD14848"/> </Grid> Width="352" Height="5"/> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </WrapPanel> 

אבל בפועל אין לי מעבר לטור חדש. מה הבעיה?

(ושאלה להמשך - האם יש אפשרות לצייר קו מפריד בין הטורים? כיצד?)

ארכיון

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

דיונים חדשים

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.