Search Results

Search found 2 results on 1 pages for 'magicmax'.

Page 1/1 | 1 

  • Silverlight data binding to parent user control's properties with using MVVM in both controls

    - by MagicMax
    Hello! I have two UserControls ("UserControlParentView" and "UserControlChildView") with MVVM pattern implemented in both controls. Parent control is a container for Child control and child control's property should be updated by data binding from Parent control in order to show/hide some check box inside Child control. Parent Control Description UserControlParentViewModel has property: private bool isShowCheckbox = false; public bool IsShowCheckbox { get { return isShowCheckbox; } set { isShowCheckbox = value; NotifyPropertyChanged("IsShowCheckbox"); } } UserControlParentViewModel - how I set DataContext of Parent control: public UserControlParentView() { InitializeComponent(); this.DataContext = new UserControlParentViewModel(); } UserControlParentView contains toggle button (in XAML), bound to UserControlParentViewModel's property IsShowCheckbox <ToggleButton Grid.Column="1" IsChecked="{Binding IsShowCheckbox, Mode=TwoWay}"></ToggleButton> Also Parent control contains instance of child element (somewhere in XAML) <local:UserControlChildView IsCheckBoxVisible="{Binding IsShowCheckbox}" ></local:UserControlChildView> so property in child control should be updated when user togggle/untoggle button. Child control contains Boolean property to be updated from parent control, but nothing happened! Breakpoint never fired! Property in UserControlChildView that should be updated from Parent control (here I plan to make chechBox visible/hidden in code behind): public bool IsCheckBoxVisible { get { return (bool)GetValue(IsCheckBoxVisibleProperty); } set { SetValue(IsCheckBoxVisibleProperty, value); } } // Using a DependencyProperty as the backing store for IsCheckBoxVisible. This enables animation, styling, binding, etc... public static readonly DependencyProperty IsCheckBoxVisibleProperty = DependencyProperty.Register("IsCheckBoxVisible", typeof(bool), typeof(TopMenuButton), new PropertyMetadata(false)); So the question is - what I'm doing wrong? Why child's property is never updated? BTW - there is no any binding error warnings in Output window...

    Read the article

  • Silverlight - how to render image from non-visible data bound user control?

    - by MagicMax
    Hello! I have such situation - I'd like to build timeline control. So I have UserControl and ItemsControl on it (every row represents some person). The ItemsControl contains another ItemsControl as ItemsControl.ItemTemplate - it shows e.g. events for the person arranged by event's date. So it looks as some kind of grid with dates as a column headers and e.g. peoples as row headers. ........................|.2010.01.01.....2010.01.02.....2010.01.03 Adam Smith....|......[some event#1].....[some event#2]...... John Dow.......|...[some event#3].....[some event#4]......... I can have a lot of persons (ItemsControl #1 - 100-200 items) and a lot of events occured by some day (1-10-30 events per person in one day) the problem is that when user scrolls ItemsControl #1/#2 it happened toooo sloooooowwww due to a lot of elements should be rendered in one time (as I have e.g. a bit of text boxes and other elements in description of particular event) Question #1 - how can I improve it? May be somebody knows better way to build such user control? I have to mention that I'm using custom Virtual panel, based on some custom Virtual panel implementation found somewhere in internet... Question #2 - I'd like to make image with help of WriteableBitmap and render data bound control to image and to show image instead of a lot of elements. Problem is that I'm trying to render invisible data bound control (created in code behind) and it has actualWidth/Height equals to zero (so nothing rendered). How can I solve it? Thank you very much for you help!

    Read the article

1