Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
260
can not access the control inside the outlookgroup
posted

Hi,

 

I am facing problem of accessing control which is there inside the outlookgroup.

 

I have 2 group

1, Date range

2. Measurements

 

Inside the date range I have 2 datetime control.

 

But when the page is initialized I set the value as follows.

  public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
            this.fromDatePicker.SelectedDate = DateTime.UtcNow;
            this.toDatePicker.SelectedDate = DateTime.UtcNow;
        }

 

but it is coming as object reference error. Even I tried with other controls and event as well.

 

For a test purpose I put a radio button and set the value IsChecked=True during design. On a button click I tried setting the checked state to false. Still I get the object reference error.

 

Any propertied of the XamOutlookbar I need to set inorder to access the control???

Please help

 

Thanks

-Sajin

Parents
No Data
Reply
  • 5595
    Suggested Answer
    posted

    Hi,

    This behavior is because of how the XamOutlookBar is designed to work. Whenever you have any elements in OutlookBarGroup and you set it's Name or x:Name property, the variable which is automatically generated to reference this element has null value at runtime.

    This is also a limitation in other controls which have items in them.

    Instead you could use this.FindName("fromDatePicker") as DatePicker .

     

    HTH,

Children