Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3322582
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:11:57+00:00 2026-05-17T23:11:57+00:00

I have a label in WPF4 and trying to bind the content to a

  • 0

I have a label in WPF4 and trying to bind the content to a value from c# class. I have created an ObjectDataProvider but for some reason can’t see the content or updates. Can you point me to what I’m doing wrong?

Here is the xaml –

<Grid.Resources>
<local:SummaryData x:Key="mySummaryData"/> </Grid.Resources>
<Label Name ="lbCurrentVerValue" Grid.Row="1" Grid.Column="2" Content="{Binding Path=frameworkVersion, Source={StaticResource mySummaryData}}"/>
<TextBox Name ="lbFromVerValue" Grid.Row="2" Grid.Column="2" Text="{Binding Source={StaticResource mySummaryData}, Path=frameworkVersion}"/>

and here is the c# code-

namespace DBUpgradeUI

{

public partial class DBUpgReadinessCheck : Window
{
    public string userConnStr = String.Empty;
    public string userFoldPath = String.Empty;
    public SummaryData sd = new SummaryData();

    public DBUpgReadinessCheck()
    {
        InitializeComponent();
    }

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        ReadinessCheck(userConnStr, userFoldPath);
    }

    public void ReadinessCheck(string connectionString, string folderPath)
    {
        FrmImportUtility frmWork = new FrmImportUtility();
        sd.frameworkVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); ;
        frmWork.CurrentlyProcessingVersion(connectionString, folderPath, ref sd.currentVersion, ref sd.finalVersion);
    }
}
public class SummaryData
{
    public string currentVersion = "Test";
    public string finalVersion = "finalVerTest";
    public string frameworkVersion = String.Empty;
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:11:57+00:00Added an answer on May 17, 2026 at 11:11 pm

    After trying ways to bind properties from a class object without having dependency properties and having no luck, I have done the following and it works like a charm!

    xaml –

      <Label Name ="lbCurrentVerValue" Grid.Row="1" Grid.Column="2" Content="{Binding Mode=OneWay, ElementName=step2Window,Path=currentVersion}"/>
      <Label Name ="lbFromVerValue" Grid.Row="2" Grid.Column="2" Content="{Binding Mode=OneWay, ElementName=step2Window,Path=finalVersion}"/>
    

    and c# code –

     public partial class DBUpgReadinessCheck : Window
    {
        //Values being passed by step1 window
        public string userConnStr = String.Empty;
        public string userFoldPath = String.Empty;
    
        //Dependency properties
        public string currentVersion
        {
            get { return (String)this.GetValue(CurVersionProperty); }
            set { this.SetValue(CurVersionProperty, value); }
        }
        public static readonly DependencyProperty CurVersionProperty =
               DependencyProperty.Register("currentVersion", typeof(String), typeof(DBUpgReadinessCheck), new UIPropertyMetadata("0"));
    
    
        public String finalVersion
        {
            get { return (String)GetValue(FinVerProperty); }
            set { SetValue(FinVerProperty, value); }
        }
        public static readonly DependencyProperty FinVerProperty =
            DependencyProperty.Register("finalVersion", typeof(String), typeof(DBUpgReadinessCheck), new UIPropertyMetadata("0"));
    
        public string frameworkVersion
        {
            get { return (String)GetValue(FrameWrkVersionProperty); }
            set { SetValue(FrameWrkVersionProperty, value); }
        }
        public static readonly DependencyProperty FrameWrkVersionProperty =
            DependencyProperty.Register("frameworkVersion", typeof(String), typeof(DBUpgReadinessCheck), new UIPropertyMetadata("0"));
    
        public DBUpgReadinessCheck()
        {
            InitializeComponent();
        }
    
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ReadinessCheck(userConnStr, userFoldPath);
        }
    
        public void ReadinessCheck(string connectionString, string folderPath)
        {
            FrmImportUtility frmWork = new FrmImportUtility();
            frameworkVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            string tempCurVersion = string.Empty;
            String tempFinalVersion = string.Empty;
            frmWork.CurrentlyProcessingVersion(connectionString, folderPath, ref tempCurVersion, ref tempFinalVersion);
            currentVersion = tempCurVersion;
            finalVersion = tempFinalVersion;
    
            //Validation
            if (finalVersion == frameworkVersion)
            {
                string strUri2 = String.Format(@"pack://application:,,,/GreenCheck.jpg");
                ImgFrmVersion.Source = new BitmapImage(new Uri(strUri2));
                yelloExclamation.Visibility = System.Windows.Visibility.Hidden;
                errMsg.Visibility = System.Windows.Visibility.Hidden;
                succMsg.Visibility = System.Windows.Visibility.Visible;
                btRecheckSetUp.Visibility = System.Windows.Visibility.Hidden;
                btStartUpgrade.IsEnabled = true;
            }
        }
    

    This works great. Thanks everyone for your help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a label in my form, and im trying to get the value
I have a Label that looks the following: <Label Name=FalsePositiveInput Content=&#x2713;> This works but
How can I have a label on a UITableViewCell but also have an arrow
i have a input tag which is non editable, but some times i need
I have a Label: <Label Name=lblBilledDate Content={Binding Path=BilledDate, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}> </Label> It is bound
If I have a label with its content White, Yellow, Black and I want
I'm getting a strange exception from s:Label in Flex 4.1. I have a parent
I have a label function like : private function formatDate (item:Object, column:DataGridColumn):String { var
I have this label control in my web page <asp:Label ID=Label1 runat=server Text=test></asp:Label> And
Here's the situation: I have a label's text set, immediately followed by a response.redirect()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.