dcsimg
Results 1 to 1 of 1

Thread: I want to be able to rollback to the value from xaml definition

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2016
    Posts
    78

    I want to be able to rollback to the value from xaml definition

    xaml codes are here:

    Code:
    <Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Button x:Name="Button1" Height="25" Width="150" Content="Change to 2000" VerticalAlignment="Top"/>
        <Button x:Name="Button2" Height="25" Width="150" Content="Change to 1000" VerticalAlignment="Center"/>
        <Label x:Name="Label1" Height="25" Width="100" Content="1000" VerticalAlignment="Bottom"/>
    </Grid>
    </Window>
    vb.net codes are here;

    Code:
    Class MainWindow 
    Private Sub Button1_Click(sender As Object, e As RoutedEventArgs) Handles Button1.Click
        Label1.Content = "2000"
    End Sub
    Private Sub Button2_Click(sender As Object, e As RoutedEventArgs) Handles Button2.Click
        Label1.Content = "1000"
    End Sub
    End Class

    Please run above codes and click Button1 then click Button2 in order to understand what that codes are doing.

    My question is here:

    I am looking for code like

    Code:
    Label1.Content = Label1 xaml definition content
    instead of

    Code:
    Label1.Content = "1000"
    So, are you able to provide a code like this?

    Code:
    Label1.Content = Label1 xaml definition content
    I want to be able to rollback to the value from xaml definition which is Content="1000"
    Last edited by Kram Kramer; Nov 28th, 2018 at 09:02 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width