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

The Archive Base Latest Questions

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

I have the Xaml which should basically bind a set of ContextualButtons for a

  • 0

I have the Xaml which should basically bind a set of ContextualButtons for a selected tab’s viewmodel to the ItemsSource property of the ToolBar. For some reason, this binding is not actually occuring unless I use Snoop to inspect the element manually…It seems that the act of snooping the element is somehow requerying the binding somehow.

Does anyone know what I might be doing wrong here? This behavior is the same if I use a Listbox as well, so I know it is something that I am doing incorrectly…but I am not sure what.

SelectedView is a bound property to the selected view from a Xam Tab control.

XAML

<ToolBar DataContext="{Binding SelectedView.ViewModel}"
     ItemsSource="{Binding ContextualButtons}" >     
     <ToolBar.ItemTemplate>
      <DataTemplate>
<!--       <Button ToolTip="{Binding Name}"-->
<!--         Command="{Binding Command}">-->
<!--        <Button.Content>-->
<!--         <Image Width="32" Height="32" Source="{Binding ImageSource}"/>-->
<!--        </Button.Content>-->
<!--       </Button>-->
       <Button Content="{Binding Name}"/>
      </DataTemplate>
     </ToolBar.ItemTemplate>

    </ToolBar>

Code

      public class TestViewModel : BaseViewModel, IBulkToolViewModel
      {


        public TestViewModel()
        {
          ContextualButtons = new ObservableCollection<IContextualButton>()
                                {
                                  new ContextualButton("Test Button",
                                                       new DelegateCommand<object>(
                                                         o_ => Trace.WriteLine("Called Test Button")), String.Empty)
                                };
        }

        public string Key { get; set; }
        private ObservableCollection<IContextualButton> _contextualButtons;
        public ObservableCollection<IContextualButton> ContextualButtons
        {
          get { return _contextualButtons; }
          set
          {
            if (_contextualButtons == value) return;
            _contextualButtons = value;
            //OnPropertyChanged("ContextualButtons");
          }
        }

      }

      public partial class TestView : UserControl, IBulkToolView
      {
        public TestView()
        {
          InitializeComponent();

        }


        public IBulkToolViewModel ViewModel { get; set; }

      }
      public class ContextualButton : IContextualButton
      {
        private string _name;
        public string Name
        {
          get { return _name; }
          set { _name = value; }
        }

        public ICommand Command { get; set; }
        public string ImageSource { get; set; }

        public ContextualButton(string name_, ICommand command_, string imageSource_)
        {
          Name = name_;
          Command = command_;
          ImageSource = imageSource_;
        }
      }

  public class BulkToolShellViewModel : BaseViewModel, IBaseToolShellViewModel, IViewModel 
  {

    private IBulkToolView _selectedView;
    public IBulkToolView SelectedView
    {
      get
      {
        return _selectedView;
      }
      set
      {
        if (_selectedView == value) return;
        _selectedView = value;
        OnPropertyChanged("SelectedView");

      }
    }
  public ObservableCollection<IBulkToolView> Views { get; set; }

    public DelegateCommand<object> AddViewCommand { get; private set; }
    public DelegateCommand<object> OpenPortfolioCommand { get; private set; }
    public DelegateCommand<object> SavePortfolioCommand { get; private set; }
    public DelegateCommand<object> GetHelpCommand { get; private set; }


    public BulkToolShellViewModel(ObservableCollection<IBulkToolView> views_)
      : this()
    {
      Views = views_;
    }

    public BulkToolShellViewModel()
    {
      Views = new ObservableCollection<IBulkToolView>();
      AddViewCommand = new DelegateCommand<object>(o_ => Views.Add(new TestView
                                                                     {
                                                                       ViewModel = new TestViewModel()
                                                                     }));
      OpenPortfolioCommand = new DelegateCommand<object>(OpenPortfolio);
      SavePortfolioCommand = new DelegateCommand<object>(SavePortfolio);
      GetHelpCommand = new DelegateCommand<object>(GetHelp);
    }

    private void GetHelp(object obj_)
    {

    }

    private void SavePortfolio(object obj_)
    {

    }

    private void OpenPortfolio(object obj_)
    {

    }

    public event PropertyChangedEventHandler PropertyChanged;
    public void RaisePropertyChanged()
    {
      throw new NotImplementedException();
    }

    public void RaisePropertyChanged(string propertyName)
    {
      throw new NotImplementedException();
    }

    public string this[string columnName]
    {
      get { throw new NotImplementedException(); }
    }

    public string Error { get; private set; }
    public AsyncContext Async { get; private set; }
    public XmlLanguage Language { get; private set; }
    public string Key { get; set; }


  }

Thanks!

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

    Why does BulkToolShellViewModel have its own PropertyChanged event along with RaisePropertyChanged methods that do nothing? Shouldn’t it inherit this functionality from BaseViewModel? Perhaps the UI is attaching to BulkToolShellViewModel.PropertyChanged rather than BaseViewModel.PropertyChanged and is never being notified of changes.

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

Sidebar

Related Questions

I Have a ResourceDictionary Generic.xaml which consists of a set of other resource dictionaries,
I have the following XAML code, which displays a picture (image inside borders) and
Suppose I have some XAML like this: <Window.Resources> <v:MyClass x:Key=whatever Text=foo\nbar /> </Window.Resources> Obviously
I have the following XAML: <TextBlock Text={Binding ElementName=EditListBox, Path=SelectedItems.Count} Margin=0,0,5,0/> <TextBlock Text=items selected> <TextBlock.Style>
Let's pretend I have the following xaml... <UserControl.Resources> <local:ViewModel x:Name=viewModel /> <local:LoadChildrenValueConverter x:Name=valueConverter />
I have a simple WPF (XAML) file that has some animated shapes and text.
I have a user control where the XAML of the control can bind to
I have multiple xaml based pages stored as children of a canvas on another
If I have a Xaml Window, how does one open it as a child
In Silverlight/XAML you have namespaces such as: xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml and so elements have namespaced attributes

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.