Xaml代码:
<helper:CustomPropertyGridControl x:Name="pgeditEquipment"
ShowMenuButtonInRows="False"
ShowCategories="True"
ExpandCategoriesWhenSelectedObjectChanged="True"
ShowProperties="All"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
SelectedObject="{Binding Path = SelectChildEquipment,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<!--LayoutUpdated="pgEquipment_LayoutUpdated"-->
<!--CustomExpand="pgEquipment_CustomExpand"-->
<dxprg:PropertyGridControl.PropertyDefinitions>
<dxprg:PropertyDefinition PostOnEditValueChanged="True" Path="PartNumber">
<dxprg:PropertyDefinition.EditSettings>
<dxe:ButtonEditSettings AllowDefaultButton="False">
<dxe:ButtonEditSettings.Buttons>
<dxe:ButtonInfo Content="SAP Search " Name="btnSapSearch" Command="{Binding Path=SAPSearchCommand}" IsDefaultButton="True" />
</dxe:ButtonEditSettings.Buttons>
</dxe:ButtonEditSettings>
</dxprg:PropertyDefinition.EditSettings>
绑定和命令
private EquipmentModel _SelectChildEquipment;
public EquipmentModel SelectChildEquipment
{
get
{
return _SelectChildEquipment;
}
set
{
_SelectChildEquipment = value;
GetEquipmentDetailsAndVisibilities();
RaisePropertyChanged("SelectChildEquipment");
}
}
private void GetEquipmentDetailsAndVisibilities()
{
if (_SelectChildEquipment == null) return;
if (_SelectChildEquipment.ID != Guid.Empty)
{
ApplicationState.SelectedEquipment =
ApplicationState.EquipmentList.Where(x => x.ID ==
ApplicationState.SelectedEquipment.ID).FirstOrDefault();
ApplicationState.SelectedChildEquipment =
ApplicationState.SelectedEquipment.BOMTreeList.Where(X => X.ID ==
_SelectChildEquipment.ID).FirstOrDefault(); ;
SelectChildDatails();
}
ActiveCheck = _SelectChildEquipment.CleanEquipmentStructure;
if (!ActiveCheck)
{
InActiveCheck = true;
}
if (_SelectChildEquipment.ID_ObjectType ==
Constants.IdProtectionDesignObjectType &&
ApplicationState.SelectedCustomer.ID_Type != Constants.IdProspectCustomer)
{
InUseNotInUseVisibility = true;
}
else
{
InUseNotInUseVisibility = false;
}
ITKKVisibility = _SelectChildEquipment.IsItkkHolderObject;
PartTypeVisibility = !_SelectChildEquipment.IsItkkHolderObject;
DeleteButtonVisibility = true;
RaisePropertyChanged("SelectChildObject");
RaisePropertyChanged("AttachmentChildList");
}
private void SAPSearch()
{
try
{
_SelectChildEquipment.PartDescription = PartDescription
= searchMaterialViewModel.MaterialList[0].MaterialDescription;
_SelectChildEquipment.PartDescription_EN=
ApplicationState.SelectedChildEquipment.PartDescription_EN =
searchMaterialViewModel.MaterialList[0].MaterialDescription_EN;
_SelectChildEquipment.DateTime_LastChange =
DateTime.Now;
RaisePropertyChanged("SelectChildEquipment");
}
catch (Exception ex)
{
CustomePropertyMessageBoxControl.ShowErrorMessageWithDetails(ex.Message,
ex.StackTrace, "Error");
}
finally
{
Splash.Splasher.CloseSplash();
}
}
我需要在sap search命令上绑定数据。命令已经在触发,上下文也在更新,但UI不在。
单击该树时,相同的SelectChildEquipment属性必定也会加载。
有什么办法可以解决此问题。重新加载数据时解决了该问题,但我希望在单击搜索按钮时完成此操作。