Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

binding checkbox ib listbox

$
0
0

Hi, I have a problem to bind class to checkboxes as a part of listbox.

So, I have a simple class

Public Class QuickLinq   
  Public Name As String
  Public Linq As String
  Public Check As Boolean
End Class 

Xaml

<ListBox x:Name="Automatization" Height="100" Margin="0" Background="#FFE6E6E6">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox x:Name="QLIC" Content="{Binding Name}" IsChecked="{Binding Check}" ToolTip="{Binding Linq}" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>

And main code

Public QuickL As New List(Of QuickLinq)

Automatization.ItemsSource = QuickL

QuickL.Add(New QuickLinq)
  QuickL(QuickL.Count - 1).Name = "MyName"
  QuickL(QuickL.Count - 1).Linq = "MyLinq"
QuickL(QuickL.Count - 1).Check = False

And it's not working... Why?


Aleksey


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>