Click here to Skip to main content
15,892,059 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Design an analysis Program Pin
Pete O'Hanlon22-Feb-11 1:46
mvePete O'Hanlon22-Feb-11 1:46 
AnswerRe: Design an analysis Program Pin
Lisa Z. Morgan23-Feb-11 5:58
Lisa Z. Morgan23-Feb-11 5:58 
QuestionHow to display a particular controls after user selection of a data from a combobox.. Pin
Rocky2321-Feb-11 20:03
Rocky2321-Feb-11 20:03 
AnswerRe: How to display a particular controls after user selection of a data from a combobox.. Pin
Mycroft Holmes21-Feb-11 21:15
professionalMycroft Holmes21-Feb-11 21:15 
GeneralRe: How to display a particular controls after user selection of a data from a combobox.. Pin
Rocky2321-Feb-11 22:29
Rocky2321-Feb-11 22:29 
GeneralRe: How to display a particular controls after user selection of a data from a combobox.. Pin
Mycroft Holmes21-Feb-11 23:58
professionalMycroft Holmes21-Feb-11 23:58 
AnswerRe: How to display a particular controls after user selection of a data from a combobox.. Pin
Jammer22-Feb-11 23:41
Jammer22-Feb-11 23:41 
QuestionWPF RoutedEvent not firing Pin
GreatBigYetti21-Feb-11 13:01
GreatBigYetti21-Feb-11 13:01 
I'm having some difficulty trying to use RoutedEvents. I'd guess this one here is easy for someone who has already done it. I'm making a 'paged' application where I'd like a completed action on one of the pages (one container) to allow changing of some content on another container or the main Window. So based on what I've read (been studying this stuff for 4 months now but apparently that's not enough), to do it correctly I should use 'RoutedEvents' to fire an event from the 'page' that goes up the container hierarchy to the main window. From there I can simply set the content within the other container. In any case, the source and target containers aren't in the same container 'chain'. I've put all what seems like the right code in and there are no errors except the event never gets fired in the main window. The problem seems all in the code behind (event not firing?). I'm not sure but I believe I've set up the handler and listener in an acceptable way based on everything I can find in reading the msdn. All the code gets executed (based on tracing through with breakpoints) but the UpdateStatusBar() method on the main window never gets fired when the RaiseEvent is triggered in the SelectDataset() method within the page. Perhaps I'm missing some fundamental understanding about the WPF definition of "point A to point B"?

For easy viewing, I've only posted the meaningful parts of the code. Here is what I have so far:

//*** page where RoutedEvent is set up and fired from
namespace BlahBlah
{

    public partial class pageCfgBrushes : Page
    {
        // Register routed event - Bubble up
        public static readonly RoutedEvent BrushSelectionChangedEvent =
            EventManager.RegisterRoutedEvent("BrushSelectionChanged", RoutingStrategy.Bubble,
            typeof(RoutedEventHandler), typeof(pageCfgBrushes));

        public event RoutedEventHandler BrushSelectionChanged
        {
            add { AddHandler(BrushSelectionChangedEvent, value); }
            remove { RemoveHandler(BrushSelectionChangedEvent, value); }
        }

        public pageCfgBrushes()
        {
            InitializeComponent();
	}

        //*** The SelectDataset is fired from a comboListbox change event on the page, and it does run this code
        private void SelectDataset(object sender, SelectionChangedEventArgs e)
        {

            // Raise the routed event "BrushSelectionChangedEvent"
            RaiseEvent(new RoutedEventArgs(BrushSelectionChangedEvent));
           
        }
    }
}




//*** MainWindow
namespace BlahBlah
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();  //Initializes XAML code
        }

        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);


            //Don't show the navigation bar on screen
            navContent.NavigationUIVisibility = NavigationUIVisibility.Hidden;
            //...

            //Display main page on load
            navContent.Navigate(new pageMain());

            //testing RoutedEvent
            pnlStatusArea.AddHandler(pageCfgBrushes.BrushSelectionChangedEvent, new RoutedEventHandler(UpdateStatusBar));

        }

        //*** But this UpdateStatusBar routine never gets run
        private void UpdateStatusBar(object sender, RoutedEventArgs e)
        {
            this.StatusBlockMsg.Text = "DataChanged Event";
        }
    }
}


Sure does take a lot to get working with this WPF in any meaningful way.

Thanks in advance for any help with this.

modified on Tuesday, February 22, 2011 5:28 AM

AnswerRe: WPF RoutedEvent not firing Pin
GreatBigYetti23-Feb-11 1:28
GreatBigYetti23-Feb-11 1:28 
QuestionMSDN Silverlight Webcast feeds from 2008! Pin
RobCroll21-Feb-11 11:32
RobCroll21-Feb-11 11:32 
AnswerRe: MSDN Silverlight Webcast feeds from 2008! Pin
Abhinav S21-Feb-11 18:28
Abhinav S21-Feb-11 18:28 
GeneralRe: MSDN Silverlight Webcast feeds from 2008! Pin
RobCroll21-Feb-11 19:19
RobCroll21-Feb-11 19:19 
Questionpitch circle Pin
pet220-Feb-11 20:31
pet220-Feb-11 20:31 
AnswerRe: pitch circle Pin
Abhinav S20-Feb-11 21:00
Abhinav S20-Feb-11 21:00 
QuestionSilverlight drawing functions Pin
bruno.picardi19-Feb-11 0:19
bruno.picardi19-Feb-11 0:19 
AnswerRe: Silverlight drawing functions Pin
SledgeHammer0119-Feb-11 5:59
SledgeHammer0119-Feb-11 5:59 
GeneralRe: Silverlight drawing functions Pin
bruno.picardi19-Feb-11 20:55
bruno.picardi19-Feb-11 20:55 
GeneralRe: Silverlight drawing functions Pin
SledgeHammer0120-Feb-11 6:15
SledgeHammer0120-Feb-11 6:15 
AnswerRe: Silverlight drawing functions Pin
Abhinav S19-Feb-11 6:51
Abhinav S19-Feb-11 6:51 
AnswerRe: Silverlight drawing functions Pin
RobCroll21-Feb-11 2:35
RobCroll21-Feb-11 2:35 
GeneralRe: Silverlight drawing functions Pin
bruno.picardi21-Feb-11 19:55
bruno.picardi21-Feb-11 19:55 
QuestionAdd a class instance that has a DataTemplate defining the class' visual appearance Pin
JimLaVine18-Feb-11 12:08
JimLaVine18-Feb-11 12:08 
AnswerRe: Add a class instance that has a DataTemplate defining the class' visual appearance Pin
RobCroll20-Feb-11 20:04
RobCroll20-Feb-11 20:04 
GeneralRe: Add a class instance that has a DataTemplate defining the class' visual appearance Pin
Mycroft Holmes20-Feb-11 20:22
professionalMycroft Holmes20-Feb-11 20:22 
GeneralRe: Add a class instance that has a DataTemplate defining the class' visual appearance Pin
RobCroll21-Feb-11 1:22
RobCroll21-Feb-11 1:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.