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

  • Home
  • SEARCH
  • 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 5929871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:28:53+00:00 2026-05-22T14:28:53+00:00

Here is my code for the window: public partial class MainWindow { private MainWindowViewModel

  • 0

Here is my code for the window:

public partial class MainWindow
{
    private MainWindowViewModel _mainWindowViewModel;

    public MainWindow()
    {
        InitializeComponent();
        _mainWindowViewModel = new MainWindowViewModel();
        DataContext = _mainWindowViewModel;
    }
}

And the view model code:

class MainWindowViewModel : ViewModelBase
{
    private BidirectionalGraph<string, IEdge<string>> _graph;

    public BidirectionalGraph<string, IEdge<string>> Graph
    {
        get { return _graph; }
        set
        {
            _graph = value;
            NotifyPropertyChanged("Graph");
        }
    }

    public MainWindowViewModel()
    {
        Graph = new BidirectionalGraph<string, IEdge<string>>();

        // test data
        const string vertex1 = "123";
        const string vertex2 = "456";
        const string vertex3 = "ddd";

        Graph.AddVertex(vertex1);
        Graph.AddVertex(vertex2);
        Graph.AddVertex(vertex3);
        Graph.AddEdge(new Edge<string>(vertex1, vertex2));
        Graph.AddEdge(new Edge<string>(vertex2, vertex3));
        Graph.AddEdge(new Edge<string>(vertex2, vertex1));
    }
}

ViewModelBase class:

class ViewModelBase : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;

    protected void NotifyPropertyChanged(string info)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(info));
        }
    }
}

And here goes the XAML:

<Controls:GraphLayout x:Name="graphLayout" Grid.Row="1" LayoutAlgorithmType="FR" OverlapRemovalAlgorithmType="FSA" HighlightAlgorithmType="Simple" Graph="{Binding Path=Graph}" />

The problem is that I can not see a thing in this layout. Maybe I bind data in the wrong way? Does Graph# works properly with WPF4?

Update: I have updated my code, but I still see nothing in graph layout.

Solved: Custom graph layout should be added to display graph correctly

public class CustomGraphLayout : GraphLayout<string, IEdge<string >, BidirectionalGraph<string, IEdge<string>>> {}
  • 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-22T14:28:54+00:00Added an answer on May 22, 2026 at 2:28 pm
    public BidirectionalGraph<string, IEdge<string>> Graph { get; set; }
    

    there’s no INotifyPropertyChanged here. Use this instead

    private BidirectionalGraph<string, IEdge<string>> _graph;
    
    public BidirectionalGraph<string, IEdge<string>> Graph
    {
        get { return _graph; }
        set
        {
            _graph = value;
            NotifyPropertyChanged("Graph");
        }
    }
    

    and make sure you have the supporting INotifyPropertyChanged implementation boilerplate

    public class MainWindowViewModel : INotifyPropertyChanged
    

    and

    #region INotifyPropertyChanged Implementation
    
    public event PropertyChangedEventHandler PropertyChanged;
    
    private void NotifyPropertyChanged(String info)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(info));
        }
    }
    
    #endregion
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my XAML code: <Window x:Class=CarFinder.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=Search for cars in TuMomo Height=480
Here a code to demonstrate an annoying problem: class A { public: A(): m_b(1),
Here is my code: var showNo = 1; window.setInterval(function() { console.log(showNo); if(showNo === 1)
Here is my spaggeti code $(#table_exams tbody tr).click(function () { window.location.hash=# +$(this).attr(exam_ID); window.location.href=/medilab/prototypes/exams/edit?examId= +
I have the following code: class Customers : BindableObject { private ObservableCollection<string> _Products =
enter code here Hi All, I have a simple windows service application that connects
I need to restart a windows mobile 6 application. Here is the code I
Ok the error is showing up somewhere in this here code if($error==false) { $query
Here is code from MSDN . I don't understand why the work isn't just
enter code here I have a table on SQL server 2005 with bigint primary

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.