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 1035065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:29:24+00:00 2026-05-16T14:29:24+00:00

I am trying to make a Facebook Client and I have XAML file like

  • 0

I am trying to make a Facebook Client and I have XAML file like this :

<UserControl x:Class="UISkripsi3.Sidebar"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:UISkripsi3="clr-namespace:UISkripsi3"
    xmlns:local="clr-namespace:UISkripsi3">
<UserControl.Template>

        <ControlTemplate TargetType="{x:Type UISkripsi3:Sidebar}">
            <DataTemplate x:Key="StatusAndOther" DataType="{x:Type local:NewsFeedResources}">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <StackPanel Orientation="Vertical">
                            <StackPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="10">
                                <Image x:Name="ProfilePicture" Source="{Binding Path=ProfilePict}" Stretch="Fill" Width="80" Height="80" VerticalAlignment="Top"></Image>
                                <StackPanel Orientation="Vertical" Margin="5">
                                    <TextBlock Text="{Binding Path=UserName}" Style="{StaticResource UserNameStyle}"  VerticalAlignment="Top"/>
                                    <TextBlock Text="{Binding Path=Message}" Foreground="White" TextWrapping="Wrap" Width="400" VerticalAlignment="Top" HorizontalAlignment="Left"/>                                      
                                    <StackPanel Orientation="Horizontal">
                                        <Image x:Name="Icon" Source="{Binding Path=icon}" Width="10" Height="10"></Image>
                                        <TextBlock Text=" via " Foreground="White"></TextBlock>
                                        <TextBlock Text="{Binding Path=attribution}" Foreground="White"></TextBlock>
                                        <StackPanel Orientation="Vertical">
                                        <Button x:Name="LikeButton" VerticalAlignment="Top" Content="like" IsEnabled="{Binding canLike}" ToolTip="Like" Click="LikeButtonClick">
                                          <Button.Style>
                                            <Style BasedOn="{StaticResource LikeButtonStyle}" TargetType="Button">
                                              <Setter Property="Visibility" Value="Visible" />
                                              <Style.Triggers>
                                                <DataTrigger Binding="{Binding hasLiked}" Value="True">
                                                  <Setter Property="Visibility" Value="Collapsed" />
                                                </DataTrigger>
                                              </Style.Triggers>
                                            </Style>
                                          </Button.Style>
                                        </Button>
                                        <Button x:Name="RemoveLikeButton" VerticalAlignment="Center" Content="remove like" IsEnabled="{Binding hasLiked}" ToolTip="Remove Like" Click="RemoveLikeButtonClick">
                                          <Button.Style>
                                            <Style BasedOn="{StaticResource RemoveLikeButtonStyle}" TargetType="Button">
                                              <Setter Property="Visibility" Value="Visible" />
                                              <Style.Triggers>
                                                <DataTrigger Binding="{Binding hasLiked}" Value="False">
                                                  <Setter Property="Visibility" Value="Collapsed" />
                                                </DataTrigger>
                                              </Style.Triggers>
                                            </Style>
                                          </Button.Style>
                                        </Button>
                                    </StackPanel>

                                    </StackPanel>
                                </StackPanel>                               
                            </StackPanel>   
                    </StackPanel>
                            <StackPanel Orientation="Vertical">
                        <ListView Name="NewsFeedList" Width="700" Height="500" Margin="10"  
                                  ItemsSource="{Binding Source={x:Static local:Sidebar.newsFeedResourcesCoba2}}" 
                                  Background="Black" 
                                  ItemTemplateSelector="{StaticResource myDataTemplateSelector}" Focusable="False">                            
                        </ListView>
                    </StackPanel>                
                    </Grid>                 
                </DataTemplate>
        </ControlTemplate>

</UserControlTemplate>

</UserControl>

Then, I have class like this

public class NewsFeedResources : System.Windows.Controls.UserControl, INotifyPropertyChanged

{       
        public event PropertyChangedEventHandler PropertyChanged;

        public string UserName { get; set; }
        public string Id { get; set; }
        public string Message { get; set; }
        public string IdPost { get; set; }
        public byte[] ProfilePict { get; set; }
        public string DestinationName { get; set; }
        public string to { get; set; }
        public byte[] UploadedPict { get; set; }
        public byte[] Attachment { get; set; }
        public string Description { get; set; }
        public string type { get; set; }
        public string nameWallPost { get; set; }
        public string captionWallPost { get; set; }
        public string link { get; set; }
        public byte[] icon { get; set; }
        public string attribution { get; set; }
        public bool canLike
    {
        get { return this.canLike; }
        set
        {
            if (this.canLike != value)
            {
                this.canLike = value;
                this.OnPropertyChanged("canLike");
            }
        }
    }
    public bool hasLiked
    {
        get { return this.hasLiked; }
        set
        {
            if (this.hasLiked != value)
            {
                this.hasLiked = value;
                this.OnPropertyChanged("hasLiked");
            }
        }
    }
    private void OnPropertyChanged(string propertyName)
    {
        if (this.PropertyChanged != null)
        {
            this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }   

}

Here is what happen when we click the LikeButton

    private void LikeButtonClick(object sender, RoutedEventArgs e)
    {

        Button btn = (Button)sender;
        NewsFeedResources obj = btn.DataContext as NewsFeedResources;
        if (null != obj)
        {
            //MessageBox.Show(obj.IdPost);
            webClient.DownloadString(obj.IdPost);
            obj.canLike = false;
            obj.hasLiked = true;
        }
    }

I want to ask how can I turn the UI automatically from Like to Unlike and vice versa using INotifyPropertyChanged, because in my source code, it encountered an infinite loop error on get { return this.canLike; }. Thanks for the help guys

  • 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-16T14:29:25+00:00Added an answer on May 16, 2026 at 2:29 pm

    I think it is because you don’t have a private variable set up for canLike. Your get is calling the get infinitely.

    Do something like this:

    private bool _canLike;
    public bool canLike
    {
        get { return this._canLike; }
        set
        {
            if (this._canLike != value)
            {
                this._canLike = value;
                this.OnPropertyChanged("canLike");
            }
        }
    

    It looks like you’re trying to use an auto-property approach where the private member variable is implicitly declared:

    public bool canLike { get; set; }
    

    where you need a normal property (along with it’s private member variable).

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

Sidebar

Related Questions

I'm trying to make a facebook like user profile page using .htaccess ie. http://example.com/<userid
I have been trying to make something like Facebook @tagged Friend name add in
Im trying to make something like this http://demos.99points.info/facebook_wallpost_system/ which is a comment system. I
I am trying to make a Facebook login in my website, I have faced
I am trying to make an application which integrates facebook and twitter. I have
I am trying to make a class to handle all my interactions with Facebook.
im trying to make a facebook like blue bar. So, i noticed they make
I am trying to make a Facebook application and I would like to publish
I'm trying to make a Facebook video application so users can have a video
I am trying to make App Distribution from Facebook for android apps. But the

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.