Help me please translate this Binding from XAML into the code: Width="{Binding Width, ElementName=dockPanel}
.
My XAML:
<ListBoxItem Content="Это строчка :D" FontWeight="Bold" Height="50" Width="{Binding Width, ElementName=dockPanel}"/>
My code is:
ListBoxItem myListBoxItem = new ListBoxItem(); myListBoxItem.FontWeight = System.Windows.FontWeights.Bold; myListBoxItem.Height = 50; myListBoxItem.Width = SetBinding(Width, dockPanel.Width); myListBoxItem.Content = "Моя строчка :D"; this.mylistbox.Items.Add(myListBoxItem);