Search Results

Search found 1 results on 1 pages for 'miloud b'.

Page 1/1 | 1 

  • WP7 silverlight custom control using popup

    - by Miloud B.
    Hi guys, I'm creating a custom datepicker, I have a textbox, once clicked it opens a calendar within a popup. What I want to do is change the size of the popup so it shows my whole calendar, but I can't manage to change it..., I've tried using Height, Width, MinHeight, MinWidth... but it doesn't work, the popup keep showing with a fixed size. The thing is that my popup's parent property isn't evaluated since it has expression issues (according to debugger), so I'm sure my popup's parent isn't the main screen( say layout grid). How can I for example make my popup open within a specific context ? This part of my code isn't XAML, it's C# code only and it looks like: using System; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using System.Windows.Controls.Primitives; namespace CalendarBranch.components { public class wpDatePicker:TextBox { private CalendarPopup calendar; private Popup popup; public wpDatePicker() { this.calendar = new CalendarPopup(); this.popup = new Popup(); this.popup.Child = this.calendar; this.popup.Margin = new Thickness(0); this.MouseLeftButtonUp += new MouseButtonEventHandler(wpDatePicker_MouseLeftButtonUp); this.calendar.onDateSelect += new EventHandler(onDateSelected); this.IsReadOnly = true; } protected void wpDatePicker_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { this.popup.Height = this.calendar.Height; this.popup.Width = this.calendar.Width; this.popup.HorizontalAlignment = HorizontalAlignment.Center; this.popup.VerticalAlignment = VerticalAlignment.Center; this.popup.HorizontalOffset = 0; this.popup.VerticalOffset = 0; this.popup.MinHeight = this.calendar.Height; this.popup.MinWidth = this.calendar.Width; this.popup.IsOpen = true; } private void onDateSelected(Object sender, EventArgs ea) { this.Text = this.calendar.SelectedValue.ToShortDateString(); this.popup.IsOpen = false; } } } PS: the class Calendar is simply a UserControl that contains a grid with multiple columns, HyperLinkButtons and TextBlocks, so nothing special. Thank you in advance guys ;) Cheers Miloud B.

    Read the article

1