Note that there are some explanatory texts on larger screens.

plurals
  1. POBinding of Label not working
    primarykey
    data
    text
    <p>my label is showing no content . what i am trying to do is i have a usercontrol TemplateForPlan and i am getting the selected item from that usecontrol and after that i am coming to next usercontrol and that selected template name must be there in label content.</p> <p>sorry for poor description . i am a newbie and just started to work on WPF. </p> <pre><code>&lt;UserControl x:Class="ChaosMonkeyUI.TemplateForPlan" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="344" d:DesignWidth="424" Name="TemplateForPlanUC"&gt; </code></pre> <p>and this this is the label on another UC to show selected template</p> <pre><code> &lt;Label Content="{Binding ElementName=TemplateForPlanUC, Path=selectedTemplate.TemplateName }" Grid.Row="1" Grid.Column="1" Height="28" HorizontalAlignment="Stretch" Name="labelTemplateName" VerticalAlignment="Stretch" Margin="10,5,0,5" /&gt; </code></pre> <p>this is .cs file of <strong>TemplateForPlan</strong> and </p> <pre><code>public partial class TemplateForPlan : UserControl { IList&lt;TemplateType&gt; template; public int noOfElementSelected; TemplateHelper xmlParser ; NewChaosSteps parentNewChaosStepPageForNextButton; public TemplateType selectedTemplate = null; public TemplateForPlan( NewChaosSteps parentNewChaosStepPageForNextButton) { InitializeComponent(); this.parentNewChaosStepPageForNextButton = parentNewChaosStepPageForNextButton; parentNewChaosStepPageForNextButton.EnableOrDisableNextButton("disable"); xmlParser = new TemplateHelper(); template = xmlParser.GetTemplates(); listTemplate.ItemsSource = template; } private void listTemplate_SelectionChanged(object sender, SelectionChangedEventArgs e) { selectedTemplate = template[listTemplate.SelectedIndex]; parentNewChaosStepPageForNextButton.EnableOrDisableNextButton("enable"); } </code></pre> <p>and TemplateType is defined in other project and its defination is: </p> <pre><code>public partial class TemplateType { private TemplateRuleType[] templateRuleField; private string templateNameField; private string templateDescriptionField; /// &lt;remarks/&gt; [System.Xml.Serialization.XmlElementAttribute("TemplateRule")] public TemplateRuleType[] TemplateRule { get { return this.templateRuleField; } set { this.templateRuleField = value; } } /// &lt;remarks/&gt; [System.Xml.Serialization.XmlAttributeAttribute()] public string TemplateName { get { return this.templateNameField; } set { this.templateNameField = value; } } /// &lt;remarks/&gt; [System.Xml.Serialization.XmlAttributeAttribute()] public string TemplateDescription { get { return this.templateDescriptionField; } set { this.templateDescriptionField = value; } } } </code></pre> <p>please also give some good link so that i can properly understand binding . i am very much confused in it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload