CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

Forum has moved

New location: CSLA .NET forum


CSLA .NET Resources:
  • CSLA .NET forum
  • CSLA .NET home page
  • PropertyStatus can't update status

    rated by 0 users
    Answered (Verified) This post has 1 verified answer | 3 Replies | 0 Followers

    Top 150 Contributor
    57 Posts
    simon posted on Tue, Aug 30 2011 9:20 AM

    I have a BusinessListBase<MaterialCategorys, MaterialCategory>, in which  i add a method  as below:

      public MaterialCategory  AddRootNode()

            {

                MaterialCategory item= MaterialCategory.NewMaterialCategory();

                this.Add(item);

                return item;

            }

    in the child BO, I add the OnUnknownPropertyChanged() 

     [Csla.RunLocal]

            protected override void Child_Create()

            {

                LoadProperty(IdProperty, System.Threading.Interlocked.Decrement(ref _lastID));

                LoadProperty(DescriptionProperty, "Test");

                BusinessRules.CheckRules();

                OnUnknownPropertyChanged();

                base.Child_Create();

            }

     BusinessRules.AddRule(new Csla.Rules.CommonRules.Required(NameProperty));

     

    but I invoke the method AddRootNode, the UI work well except the propertystatus.

    I use ViewModel<MaterialCategory>. in which i invoke the method:

     

            private  void AddRootNode()

            {

               var SelectedItem= Model.AddRootNode();

            }

    the csla version is 4.2.

    Answered (Verified) Verified Answer

    Top 10 Contributor
    2,279 Posts
    Answered (Verified) JonnyBee replied on Tue, Aug 30 2011 10:04 AM
    Verified by simon

    If  you are using the Csla 4.2 Alpha then you should update to the latest Csla.Xaml.PropertyStatus from trunk.

    PropertyStatus would miss updating UI if a control is not visible when page is shown (ie non visible tab page).

     

    Jonny Bekkum, Norway CslaContrib Coordinator

    All Replies

    Top 10 Contributor
    2,279 Posts
    Suggested by JonnyBee

    How do you bind PropertyStatus to the BO?

    You should define DataContext either on each PropertyStatus or the Xaml container.

    Jonny Bekkum, Norway CslaContrib Coordinator

    Top 150 Contributor
    57 Posts
    simon replied on Tue, Aug 30 2011 9:55 AM

    In my view:

     

      <TabControl Grid.Row="1"  Name="tabControl1"  >

                <TabItem Header="Overview" Name="tabItem1">

                    <!--local:MaterialCategoryListView DataContext="{Binding}"/-->

                    <TreeView Name="CategoryTreeView" ItemsSource="{Binding Path=Model}"  

                     ItemTemplate ="{StaticResource NavigationTemplate }" >

                        <TreeView.ItemContainerStyle>

                            <!-- This Style binds a TreeViewItem to a PersonViewModel.  -->

                            <Style TargetType="{x:Type TreeViewItem}">

                                <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />

                                <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />

                                <Setter Property="FontWeight" Value="Normal" />

                                <Style.Triggers>

                                    <Trigger Property="IsSelected" Value="True">

                                        <Setter Property="FontWeight" Value="Bold" />

                                    </Trigger>

                                </Style.Triggers>

                            </Style>

                        </TreeView.ItemContainerStyle>

     

                    </TreeView>

                </TabItem>

                <TabItem Header="Base" >

                    <local:MaterialCategoryBaseView DataContext="{Binding ElementName=CategoryTreeView, Path=SelectedItem}"/>

                </TabItem>

            </TabControl>

    in the MaterialCategoryBaseView :

    <csla:PropertyStatus Grid.Column="2" Margin="11,11,86,3" Name="propertyStatus1" Width="20" Height="20" Property="{Binding Path=Name }" />

     

    When I add the new item, i first click the row, and shift to the tab "Base",  the error doesn't appear. 

    if i move  the focus to  another row and then back to the new row, the error will present 

    Top 10 Contributor
    2,279 Posts
    Answered (Verified) JonnyBee replied on Tue, Aug 30 2011 10:04 AM
    Verified by simon

    If  you are using the Csla 4.2 Alpha then you should update to the latest Csla.Xaml.PropertyStatus from trunk.

    PropertyStatus would miss updating UI if a control is not visible when page is shown (ie non visible tab page).

     

    Jonny Bekkum, Norway CslaContrib Coordinator

    Page 1 of 1 (4 items) | RSS

    Copyright (c) 2006-2014 Marimer LLC. All rights reserved.
    Email admin@lhotka.net for support.
    Powered by Community Server (Non-Commercial Edition), by Telligent Systems