SORU
9 EYLÜL 2009, ÇARŞAMBA


ListBox yok.SelectionMode=&; Hiçbiri" quot;, bir listbox seçimi devre dışı bırakmak için başka bir yol var mı?

Nasıl bir ListBox seçimi devre dışı bırakırım?

CEVAP
9 EYLÜL 2009, ÇARŞAMBA


1 - ItemsControl yaklaşım

ListBox, diğer yönleri ihtiyacın yoksa ItemsControl yerine kullanabilirsiniz. ItemsPanel öğeleri yerleştirir ve seçim kavramı yok.

<ItemsControl ItemsSource="{Binding MyItems}" />

Varsayılan alt öğelerinden sanallaştırma desteklemiyor. Eğer öğeleri bir sürü varsa, sanallaştırma bellek kullanımını azaltmak ve bu durumda yaklaşım 2 kullanabilirsin performansı geliştirmek ve ListBox add virtualisation to your ItemsControl tarzı.

2 - Şekillendirme ListBox Yaklaşım

Alternatif olarak, sadece stil seçimi gibi Liste kutusu görünür değil.

<ListBox.Resources>
  <Style TargetType="ListBoxItem">
    <Style.Resources>
      <!-- SelectedItem with focus -->
      <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
                       Color="Transparent" />
      <!-- SelectedItem without focus -->
      <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}"
                       Color="Transparent" />
      <!-- SelectedItem text foreground -->
      <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}"
                       Color="Black" />
    </Style.Resources>
    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  </Style>
</ListBox.Resources>

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Kayla Caton - Peet

    Kayla Caton

    23 HAZİRAN 2012
  • PhoneArena

    PhoneArena

    7 NİSAN 2006
  • UberFacts

    UberFacts

    26 EKİM 2013