Mashup – Enable a button based on status and CurrentItemChanged

I’ll show you how to enabled a button on a current item changed event in a Mashup list. The scenario is as follows: You have a list of planned orders and you want to add a button to execute a related option but only if the order status has a specific value. I’ll show you how to set a property value in an event and how to execute a related option using a button. The real case scenario here would be planned work orders in MOS197 but for simplicity if you don’t use that module I’ll simulate the checks by using a much simpler program and one of my favorites, CRS610. The hard part is to reset the IsEnabled for the button to be false so that it does not keep its state as we select different rows in the list.

One trick is to use the Running event as described in a previous post. Another approach I’ll show you now is to use the same Event – twice. You might need to apply both these approaches if your list reloads, based on another selection, and you are very specific that the button should be disabled until the first row is selected. These tricks are quire useful and can be applied to S3 / Lawson mashups as well.

Let’s start by adding the list with a start-up event and the button that will run a related option.

<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:Mango.UI.Controls;assembly=Mango.UI" xmlns:mashup="clr-namespace:Mango.UI.Services.Mashup;assembly=Mango.UI" xmlns:m3="clr-namespace:MForms.Mashup;assembly=MForms">
  <Grid.Resources></Grid.Resources>
  <Grid.ColumnDefinitions>
    <ColumnDefinition Width="*" />
    <ColumnDefinition Width="Auto" />
  </Grid.ColumnDefinitions>
  <Grid.RowDefinitions>
    <RowDefinition Height="*" />
    <RowDefinition Height="Auto" />
  </Grid.RowDefinitions>
  <m3:ListPanel Name="listCustomers">
    <m3:ListPanel.Events>
      <mashup:Events>
        <mashup:Event SourceEventName="Startup">
          <mashup:Parameter TargetKey="OKCONO" />
          <mashup:Parameter TargetKey="OKCUNO" />
        </mashup:Event>
        <mashup:Event SourceName="listCustomers" SourceEventName="CurrentItemChanged" Target="{mashup:SetProperty ElementName=buttonOption, Path=IsEnabled}">
          <mashup:Event.Conditions>
            <mashup:Conditions>
              <mashup:Condition TargetKey="OKSTAT" SourceValue="20" Operator="Equal" />
            </mashup:Conditions>
          </mashup:Event.Conditions>

          <mashup:Parameter TargetKey="Value" Value="True" />
        </mashup:Event>
      </mashup:Events>
    </m3:ListPanel.Events>
    <m3:ListPanel.Bookmark>
      <m3:Bookmark Program="CRS610" Table="OCUSMA" KeyNames="OKCONO,OKCUNO" />
    </m3:ListPanel.Bookmark>
  </m3:ListPanel>
  
  <Button Name="buttonOption" Width="120" IsEnabled="false" Content="Related option" Grid.Column="1" VerticalAlignment="Center" Margin="10,10,10,0" />
</Grid>

List

This code almost work. We have the button and it is disabled and enabled only when status is 20, but as we select a new row the button remains enabled even if the condition is no longer met. One way to fix this is to add a new Event for CurrentItemChanged that always disables the button. It will be called before the conditional event so it will always re-set the IsEnabled to false.

<mashup:Event SourceName="listCustomers" SourceEventName="CurrentItemChanged" Target="{mashup:SetProperty ElementName=buttonOption, Path=IsEnabled}">>
   <mashup:Parameter TargetKey="Value" Value="False" />
</mashup:Event>

Note that you need to edit the XAML and move this line so that it comes after the conditional event. This approach is good to remember.

Mapping a related option to a button

Before writing this post I did not know how to map a button event to a list option. So I went into the Events for the button, added a click event and mapped it to a ListOption. But I did not get a suggestion for what TargetKey to use. I would have guessed for Option but there were no suggestion in the Parameters section after adding a new parameter. See below.

ListOption

I need to know more about the M3 ListPanel so I opened the SDK Documentation (unde Help menu in the Designer). I wanted to know more about the ListOption event so I searched for “ListOption”… and I found what I was looking for. The parameter name was described in the help it should be Option. Of course it would be nice if this information was in the tool but I think there is a limitation here that the editor does not support different target keys based on the name of the event.

SDKDoc

If you are using the Mashup controls and are not sure how to use them – don’t forget to check the code documentation.

Complete XAML below:

<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:Mango.UI.Controls;assembly=Mango.UI" xmlns:mashup="clr-namespace:Mango.UI.Services.Mashup;assembly=Mango.UI" xmlns:m3="clr-namespace:MForms.Mashup;assembly=MForms">
  <Grid.Resources></Grid.Resources>
  <Grid.ColumnDefinitions>
    <ColumnDefinition Width="*" />
    <ColumnDefinition Width="Auto" />
  </Grid.ColumnDefinitions>
  <Grid.RowDefinitions>
    <RowDefinition Height="*" />
    <RowDefinition Height="Auto" />
  </Grid.RowDefinitions>
  <m3:ListPanel Name="listCustomers">
    <m3:ListPanel.Events>
      <mashup:Events>
        <mashup:Event SourceEventName="Startup">
          <mashup:Parameter TargetKey="OKCONO" />
          <mashup:Parameter TargetKey="OKCUNO" />
        </mashup:Event>
        <mashup:Event SourceName="listCustomers" SourceEventName="CurrentItemChanged" Target="{mashup:SetProperty ElementName=buttonOption, Path=IsEnabled}">
          <mashup:Parameter TargetKey="Value" Value="False" />
        </mashup:Event>
        <mashup:Event SourceName="listCustomers" SourceEventName="CurrentItemChanged" Target="{mashup:SetProperty ElementName=buttonOption, Path=IsEnabled}">
          <mashup:Event.Conditions>
            <mashup:Conditions>
              <mashup:Condition TargetKey="OKSTAT" SourceValue="20" Operator="Equal" />
            </mashup:Conditions>
          </mashup:Event.Conditions>
          <mashup:Parameter TargetKey="Value" Value="True" />
        </mashup:Event>
      </mashup:Events>
    </m3:ListPanel.Events>
    <m3:ListPanel.Bookmark>
      <m3:Bookmark Program="CRS610" Table="OCUSMA" KeyNames="OKCONO,OKCUNO" />
    </m3:ListPanel.Bookmark>
  </m3:ListPanel>
  
  <Button Name="buttonOption" Width="120" IsEnabled="false" Content="Related option" Grid.Column="1" VerticalAlignment="Center" Margin="10,10,10,0">
    <Button.CommandParameter>
      <mashup:Events>
        <mashup:Event TargetName="listCustomers" SourceEventName="Click" TargetEventName="ListOption">
          <mashup:Parameter TargetKey="Option" Value="11" />
        </mashup:Event>
      </mashup:Events>
    </Button.CommandParameter>
  </Button>
</Grid>

22 thoughts on “Mashup – Enable a button based on status and CurrentItemChanged

  1. thibaudatwork

    Hi, I see the event uses TargetEventName=”ListOption” to start a Related Options. Is there an equivalent TargetEventName=”Key” to press Action keys? I need a button that presses F15 like we could do with MForms Automation it’s possible. Thanks. /Thibaud

    1. norpe

      There is no event but you can use a button with a command. The example below shows a button that triggers the F5 function key. Note that the CommandTarget attribute must be set to the ListPanel unless the button is created within the ListPanel (using a ContentPresenter to show the list).

      <Button Command="{x:Static mforms:MFormsCommands.FunctionKey}" CommandParameter="F5" CommandTarget="{Binding ElementName=yourListPanel}" />
      
      1. thibaudatwork

        Great! I confirm your code works for me; I have Smart Office 10.1.1.1.5. I just had to add the namespace xmlns:mforms=”clr-namespace:MForms;assembly=MForms”. Thanks. /Thibaud

  2. Mikael Malmberg

    Hi,

    this is the button, and tried to use your above example, but didn’t work.

     <xaml><Button Name="Refresh" Content="Refresh" Margin="2" Height="20" Width="100" VerticalAlignment="Center" HorizontalAlignment="Left" /></xaml>
    
    1. karinpb Post author

      I don’t think all the code is there. You have a button – but no command is set on it.

      <Button Command="{x:Static mforms:MFormsCommands.FunctionKey}" CommandParameter="F5" CommandTarget="{Binding ElementName=yourListPanel}" />

  3. Mikael

    Hi, I tried to add as per your example, didn’t work however. Got the following message:

    Provide value on “System.Windows.Markup.StaticsExtension” trhew an exception

     <xaml><Button Name="Refresh" Content="Refresh" Margin="2" Height="20" Width="100" VerticalAlignment="Center" HorizontalAlignment="Left" />
    			<Button Command="{x:Static mforms:MFormsCommands.FunctionKey}" CommandParameter="F5" CommandTarget="{Binding ElementName=LPPlannedMO}" /></xaml>
     
    1. karinpb Post author

      Hi,
      That seems correct but perhaps you could share the entire xaml or a simplified one with the list and the button and nothing else. Then I could try it here in the Mashup Designer.

  4. CAS

    Hi there, I was just wondering if it was also possible to trigger a button or event based on the outcome of an API call in a Mashup; for example I’m using a button to trigger an API call to update an M3 status and I would like to trigger another event or enable a button if the API is successful i.e. if no api error message is received. I have the solution working currently by calling a second API call directly after the first to return the new status and then enabling the button/event depending on the outcome of the status change. I was just wondering if it was possible to make the process simpler and eliminate the second API call to check the status and simply use the API dialog message instead. Thank you in advance (running Smart Office version 10.2 and M3 business engine 14.1)

    1. karinpb Post author

      Hi, There is no good fit for what you would like to do. There is an UpdateComplete event but it will be raised even if there is an error. We have thought about adding more events to cover this and similar scenarios. I’ve added your description of the problem to the enhancement request. But for now I’m afraid there is no other way around it… unless a successful call returns some data that you could check in a binding. But it if is just OK / NOK then I’m not sure. If it returns data upon success then perhaps there is a way.

  5. Mikael Malmberg

    Hi Karin, thank for all your support:

     <xaml><Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:Mango.UI.Controls;assembly=Mango.UI" xmlns:mashup="clr-namespace:Mango.UI.Services.Mashup;assembly=Mango.UI" xmlns:m3="clr-namespace:MForms.Mashup;assembly=MForms">
    	<Grid.Resources></Grid.Resources>
    	<Grid.ColumnDefinitions>
    		<ColumnDefinition Width="1*" />
    	</Grid.ColumnDefinitions>
    	<Grid.RowDefinitions>
    		<RowDefinition Height="1*" />
    		<RowDefinition Height="Auto" />
    		<RowDefinition Height="Auto" />
    		<RowDefinition Height="1*" />
    		<RowDefinition Height="Auto" />
    	</Grid.RowDefinitions>
    	<ui:StatusBar Name="StatusBar" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="1" Grid.RowSpan="1" />
    	<m3:ListPanel Name="LPPlannedMO" Header="Planned MO. Open" IsListHeaderVisible="True" Grid.Column="0" Grid.ColumnSpan="1" Grid.Row="0" Grid.RowSpan="1" InternalOptions="11">
    		<m3:ListPanel.Events>
    			<mashup:Events>
    				<mashup:Event TargetName="LPPlannedMO" SourceEventName="Startup">
    					<mashup:Parameter TargetKey="ROCONO" Type="Numeric" />
    					<mashup:Parameter TargetKey="ROPLPN" Type="String" />
    					<mashup:Parameter TargetKey="ROPLPS" Type="String" />
    				</mashup:Event>
    			</mashup:Events>
    		</m3:ListPanel.Events>
    		<m3:ListPanel.Bookmark>
    			<m3:Bookmark Program="PMS170" Table="MMOPLP" KeyNames="ROCONO,ROPLPN,ROPLPS" IncludeStartPanel="True" SortingOrder="1" View="HOG01-01" />
    		</m3:ListPanel.Bookmark>
    	</m3:ListPanel>
    	<StackPanel Orientation="Horizontal" Grid.Column="0" Grid.ColumnSpan="1" Grid.Row="1" Grid.RowSpan="1" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0">
    		<Button Name="Change" Content="Change" Margin="2" Height="20" Width="100" VerticalAlignment="Center" HorizontalAlignment="Left">
    			<Button.CommandParameter>
    				<mashup:Events>
    					<mashup:Event TargetName="LPPlannedMO" SourceEventName="Click" TargetEventName="ListOption">
    						<mashup:Parameter TargetKey="Option" Value="2" />
    					</mashup:Event>
    				</mashup:Events>
    			</Button.CommandParameter>
    		</Button>
    		<Button Name="Release" Margin="2" Height="20" Width="100" Content="Release" VerticalAlignment="Center" HorizontalAlignment="Left">
    			<Button.CommandParameter>
    				<mashup:Events>
    					<mashup:Event TargetName="LPPlannedMO" SourceEventName="Click" TargetEventName="ListOption">
    						<mashup:Parameter TargetKey="Option" Value="11" />
    					</mashup:Event>
    				</mashup:Events>
    			</Button.CommandParameter>
    		</Button>
    
    
    		<xaml><Button Name="Refresh" Content="Refresh" Margin="2" Height="20" Width="100" VerticalAlignment="Center" HorizontalAlignment="Left" />
               <Button Command="{x:Static mforms:MFormsCommands.FunctionKey}" CommandParameter="F5" CommandTarget="{Binding ElementName=LPPlannedMO}" /></xaml>
    		<Button Name="CheckCapacity" Content="Check Capacity" Margin="20,2,2,2" Height="20" Width="100" VerticalAlignment="Center" HorizontalAlignment="Left">
    			<Button.CommandParameter>
    				<mashup:Events>
    					<mashup:Event TargetName="LPPlannedMO" SourceEventName="Click" TargetEventName="ListOption">
    						<mashup:Parameter TargetKey="Option" Value="16" />
    					</mashup:Event>
    				</mashup:Events>
    			</Button.CommandParameter>
    		</Button>
    		<Button Name="CheckMaterial" Content="Check Material" Margin="2" Height="20" Width="100" VerticalAlignment="Center" HorizontalAlignment="Left">
    			<Button.CommandParameter>
    				<mashup:Events>
    					<mashup:Event TargetName="LPPlannedMO" SourceEventName="Click" TargetEventName="ListOption">
    						<mashup:Parameter TargetKey="Option" Value="12" />
    					</mashup:Event>
    				</mashup:Events>
    			</Button.CommandParameter>
    		</Button>
    	</StackPanel>
    	<GridSplitter Name="GS1" Style="{DynamicResource styleGridSplitterHorizontalMashup}" Grid.Column="0" Grid.ColumnSpan="1" Grid.Row="2" Grid.RowSpan="1" />
    	<TabControl Name="TabControl" TabStripPlacement="Top" Grid.Column="0" Grid.ColumnSpan="1" Grid.Row="3" Grid.RowSpan="1" Margin="5">
    		<TabItem Header="Material Plan">
    			<m3:ListPanel Name="LPMaterialPlan" IsListHeaderVisible="True">
    				<m3:ListPanel.Events>
    					<mashup:Events>
    						<mashup:Event SourceName="LPPlannedMO" TargetName="LPMaterialPlan" SourceEventName="CurrentItemChanged">
    							<mashup:Parameter TargetKey="MOCONO" SourceKey="ROCONO" Type="Numeric" />
    							<mashup:Parameter TargetKey="MOWHLO" SourceKey="ROWHLO" Type="String" />
    							<mashup:Parameter TargetKey="MOITNO" SourceKey="ROPRNO" Type="String" />
    							<mashup:Parameter SourceKey="ROPLPN" TargetKey="MORIDN" Type="String" />
    						</mashup:Event>
    					</mashup:Events>
    				</m3:ListPanel.Events>
    				<m3:ListPanel.Bookmark>
    					<m3:Bookmark Program="MMS080" Table="MITPLO" KeyNames="MOCONO,MOWHLO,MOITNO,MOPLDT,MOTIHM,MOORCA,MORIDN,MORIDL,MORIDX,MORIDI,MOSTAT" IncludeStartPanel="True" SortingOrder="1" />
    				</m3:ListPanel.Bookmark>
    			</m3:ListPanel>
    		</TabItem>
    		<TabItem Header="Product Structure">
    			<m3:ListPanel Name="LPProductStructure" IsListHeaderVisible="True">
    				<m3:ListPanel.Events>
    					<mashup:Events>
    						<mashup:Event SourceName="LPPlannedMO" TargetName="LPProductStructure" SourceEventName="CurrentItemChanged">
    							<mashup:Parameter SourceKey="ROCONO" Value="1" Type="Numeric" />
    							<mashup:Parameter TargetKey="WBFACI" SourceKey="ROFACI" Type="String" />
    							<mashup:Parameter TargetKey="WBPRNO" SourceKey="ROPRNO" Type="String" />
    							<mashup:Parameter TargetKey="WBSTRT" SourceKey="ROSTRT" Type="String" />
    						</mashup:Event>
    					</mashup:Events>
    				</m3:ListPanel.Events>
    				<m3:ListPanel.Bookmark>
    					<m3:Bookmark Program="PDS002" Table="MPDMAT" KeyNames="PMCONO,PMFACI,PMPRNO,PMSTRT,PMMSEQ,PMFDAT" FieldNames="WBFACI,WBPRNO,WBSTRT,WBSTRD" IncludeStartPanel="True" SortingOrder="1" />
    				</m3:ListPanel.Bookmark>
    			</m3:ListPanel>
    		</TabItem>
    	</TabControl>
    </Grid></xaml>
    
  6. Priyantha

    Hi karinpb,

    I have developed mashup and I need to pass ListPanel Header information which is entered by user to pass MForms automation to open same program with Entered value to . How can I Pass List Header information to Button Clock event

    Could you Please help me

    My Sample code

    Thank you
    Priyantha

  7. priyanthahet
    
    <Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mashup="clr-namespace:Mango.UI.Services.Mashup;assembly=Mango.UI" xmlns:m3="clr-namespace:MForms.Mashup;assembly=MForms" Name="Purch_Plan">
    	<Grid.Resources>
    		<!-- Enables SupressZero and overrides the default number format -->
    		<m3:M3DoubleConverter x:Key="m3DoubleConverter" SuppressZero="True" NumberFormat="n2" />
    		<m3:M3DateConverter x:Key="m3DateConverter" />
    	</Grid.Resources>
    	<Grid.ColumnDefinitions>
    		<ColumnDefinition Width="*" />
    	</Grid.ColumnDefinitions>
    	<Grid.RowDefinitions>
    		<RowDefinition Height="*" />
    		<RowDefinition Height="Auto" />
    	</Grid.RowDefinitions>
    	<Button Name="BtnPPS170" Content="Create PO" Margin="5,0" HorizontalAlignment="Right" Grid.Row="1">
    		<Button.CommandPaurameter>
    			<mashup:Events>
    				<mashup:Event SourceEventName="Click" LinkUri="mforms://_automation?data=%3c%3fxml+version%3d%221.0%22+encoding%3d%22utf-8%22%3f%3e%3csequence%3e%3cstep+command%3d%22RUN%22+value%3d%22PPS170%22+%2f%3e%3cstep+command%3d%22KEY%22+value%3d%22ENTER%22%3e%3cfield+name%3d%22WWQTTP%22%3e{QTTP}%3c%2ffield%3e%3cfield+name%3d%22WOPAVR%22%3e{PAVR}%3c%2ffield%3e%3cfield+name%3d%22WFFACI%22%3e{AFACI}%3c%2ffield%3e%3cfield+name%3d%22WTFACI%22%3e{BFACI}%3c%2ffield%3e%3cfield+name%3d%22WWSTS1%22%3e{CSTS1}%3c%2ffield%3e%3cfield+name%3d%22WWSTS2%22%3e{DSTS2}%3c%2ffield%3e%3cfield+name%3d%22WWPLC1%22%3e{EPLC1}%3c%2ffield%3e%3cfield+name%3d%22WWPLC2%22%3e{FPLC2}%3c%2ffield%3e%3cfield+name%3d%22WFACTP%22%3e{GACTP}%3c%2ffield%3e%3cfield+name%3d%22WTACTP%22%3e{HACTP}%3c%2ffield%3e%3cfield+name%3d%22WFGETY%22%3e{IGETY}%3c%2ffield%3e%3cfield+name%3d%22WTGETY%22%3e{JGETY}%3c%2ffield%3e%3c%2fstep%3e%3c%2fsequence%3e" Debug="True">
    					<mashup:Parameter TargetKey="QTTP" Value="82" />
    					<mashup:Parameter TargetKey="PAVR" Value="A09" />
    					<mashup:Parameter TargetKey="AFACI" SourceKey="{Binding }" />
    					<mashup:Parameter TargetKey="BFACI" SourceKey="WTFACI" />
    					<mashup:Parameter TargetKey="CSTS1" Value="A" />
    					<mashup:Parameter TargetKey="DSTS2" Value="B" />
    					<mashup:Parameter TargetKey="EPLC1" Value="C" />
    					<mashup:Parameter TargetKey="FPLC2" Value="D" />
    					<mashup:Parameter TargetKey="GACTP" Value="E" />
    					<mashup:Parameter TargetKey="HACTP" Value="F" />
    					<mashup:Parameter TargetKey="IGETY" Value="G" />
    					<mashup:Parameter TargetKey="JGETY" Value="H" />
    				</mashup:Event>
    			</mashup:Events>
    		</Button.CommandParameter>
    	</Button>
    	<m3:ListPanel Name="Proposals" IsListHeaderVisible="True" Header="Purchase Order Proposals" IncludeOptions="11" Grid.Row="0">
    		<m3:ListPanel.Events>
    			<mashup:Events>
    				<mashup:Event SourceEventName="Startup">
    					<mashup:Parameter TargetKey="OKCONO" />
    					<mashup:Parameter TargetKey="OKCUNO" />
    				</mashup:Event>
    			</mashup:Events>
    		</m3:ListPanel.Events>
    		<m3:ListPanel.Bookmark>
    			<m3:Bookmark Program="PPS170" Table="MPOPLP" KeyNames="POCONO,POPLPN,POPLPS,POPLP2" SortingOrder="3" View="A04" IncludeStartPanel="True" FieldNames="WFFACI,WTFACI,WWSTS1,WWSTS2,WWPLC1,WWPLC2,WFACTP,WTACTP,WFGETY,WTGETY," ParameterNames="WFFACI,WTFACI,WWSTS1,WWSTS2,WWPLC1,WWPLC2,WFACTP,WTACTP,WFGETY,WTGETY," />
    		</m3:ListPanel.Bookmark>
    	</m3:ListPanel>
    </Grid>
    
    
  8. Damian Clark

    Hi Karinpb

    Do you have any examples of code which uses a close event to trigger a refresh of list panel.

    I have a mashup where i open up a window to make changes using an MIPanel and causes a change. when the API is successful the window closes. I Would then like the list to refresh to reflect that change.

    Any ideas?

    Many thanks
    Damian

    1. karinpb Post author

      Here is an example, when the MITransaction in the dialog is complete and then the customer parameter is set and the dialogs closes it calls a refresh on the list.

      <Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:Mango.UI.Controls;assembly=Mango.UI" xmlns:mashup="clr-namespace:Mango.UI.Services.Mashup;assembly=Mango.UI" xmlns:m3="clr-namespace:MForms.Mashup;assembly=MForms">
      	<Grid.ColumnDefinitions>
      		<ColumnDefinition Width="1*" />
      	</Grid.ColumnDefinitions>
      	<Grid.RowDefinitions>
      		<RowDefinition Height="Auto" />
      		<RowDefinition Height="1*" />
      		<RowDefinition Height="Auto" />
      		<RowDefinition Height="Auto" />
      	</Grid.RowDefinitions>
      	<StackPanel Grid.Row="0" Orientation="Horizontal">
      		<TextBox Name="SearchCustomerTextBox" Width="200" Margin="0" VerticalAlignment="Center" />
      		<Button Content="{mashup:Constant Key=Search,File=Mango.UI}" Width="100" VerticalAlignment="Center" Margin="10,0,0,0">
      			<Button.CommandParameter>
      				<mashup:Events>
      					<mashup:Event SourceEventName="Click" TargetName="CustomerList" TargetEventName="List">
      						<mashup:Parameter TargetKey="CUNO" Value="{Binding ElementName=SearchCustomerTextBox, Path=Text}" />
      					</mashup:Event>
      				</mashup:Events>
      			</Button.CommandParameter>
      		</Button>
      	</StackPanel>
      	<m3:MIListPanel Name="CustomerList" Margin="0,15,0,0" Grid.Row="1">
      		<m3:MIListPanel.Events>
      			<mashup:Events>
      				<mashup:Event SourceEventName="Startup" TargetEventName="List" />
      			</mashup:Events>
      		</m3:MIListPanel.Events>
      		<m3:MIListPanel.DataSource>
      			<m3:MIDataSource Program="CRS610MI" Transaction="LstByNumber" Type="List" InputFields="CUNO" OutputFields="CUNO,CUNM,CUA1,CUA2" MaxReturnedRecords="200" />
      		</m3:MIListPanel.DataSource>
      		<ListView ItemsSource="{Binding Items}" Style="{DynamicResource styleListView}" ItemContainerStyle="{DynamicResource styleListViewItem}">
      			<ListView.View>
      				<GridView ColumnHeaderContainerStyle="{DynamicResource styleGridViewColumnHeader}">
      					<GridView.Columns>
      						<GridViewColumn Header="Customer number" DisplayMemberBinding="{Binding [CUNO]}" />
      						<GridViewColumn Header="Customer name" DisplayMemberBinding="{Binding [CUNM]}" />
      						<GridViewColumn Header="Customer address 1" DisplayMemberBinding="{Binding [CUA1]}" />
      						<GridViewColumn Header="Customer address 2" DisplayMemberBinding="{Binding [CUA2]}" />
      					</GridView.Columns>
      				</GridView>
      			</ListView.View>
      		</ListView>
      	</m3:MIListPanel>
      	<Button Name="editBtn" Content="Edit" IsDefault="True" Style="{DynamicResource styleButtonPrimaryMashup}">
      		<Button.CommandParameter>
      			<mashup:Events>
      				<mashup:Event TargetName="editDialog" SourceEventName="Click" TargetEventName="Open" Debug="True">
      					<mashup:Parameter TargetKey="CUNO" Value="{Binding ElementName=CustomerList, Path=CurrentItem[CUNO]}" />
      				</mashup:Event>
      			</mashup:Events>
      		</Button.CommandParameter>
      	</Button>
      	<mashup:Dialog Name="editDialog" Uri="edit.xaml" WindowHeight="200" WindowWidth="300">
      		<mashup:Dialog.Events>
      			<mashup:Events>
      				<mashup:Event SourceName="editDialog" TargetName="CustomerList" SourceEventName="CurrentItemChanged" TargetEventName="Refresh" Debug="True">
      					<mashup:Parameter SourceKey="Customer" TargetKey="CUNO" />
      				</mashup:Event>
      			</mashup:Events>
      		</mashup:Dialog.Events>
      	</mashup:Dialog>
      	<ui:StatusBar Name="StatusBar" Grid.Row="3" Grid.Column="0" />
      </Grid>
      

      The dialog edit.xaml

      <Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:Mango.UI.Controls;assembly=Mango.UI" xmlns:mashup="clr-namespace:Mango.UI.Services.Mashup;assembly=Mango.UI" xmlns:m3="clr-namespace:MForms.Mashup;assembly=MForms">
      	<Grid.ColumnDefinitions>
      		<ColumnDefinition Width="*" />
      	</Grid.ColumnDefinitions>
      	<Grid.RowDefinitions>
      		<RowDefinition Height="*" />
      		<RowDefinition Height="Auto" />
      	</Grid.RowDefinitions>
      	<m3:MIPanel Name="CustomerDetail" Grid.Row="2" Margin="0,15,0,0">
      		<m3:MIPanel.Events>
      			<mashup:Events>
      				<mashup:Event SourceEventName="Startup" TargetEventName="Get" TargetName="CustomerDetail" Debug="True">
      					<mashup:Parameter TargetKey="CUNO" Value="11953" />
      				</mashup:Event>
      				<mashup:Event SourceName="CustomerDetail" SourceEventName="UpdateComplete" TargetEventName="Close">
      					<mashup:Parameter SourceKey="CUNO" TargetKey="Customer" />
      				</mashup:Event>
      			</mashup:Events>
      		</m3:MIPanel.Events>
      		<m3:MIPanel.DataSources>
      			<m3:MIDataSourceList>
      				<m3:MIDataSource Program="CRS610MI" Transaction="GetBasicData" Type="Get" InputFields="CUNO" OutputFields="CUNM,CUNO,CUA1,CUA2,CUA3,CUA4,YREF,CSCD" />
      				<m3:MIDataSource Program="CRS610MI" Transaction="ChgBasicData" Type="Update" InputFields="CUNO,CUA1,CUA2,CUA3,CUNM,CUA4,YREF,CSCD" MandatoryInputFields="CUNO" />
      			</m3:MIDataSourceList>
      		</m3:MIPanel.DataSources>
      		<Grid>
      			<Grid.ColumnDefinitions>
      				<ColumnDefinition Width="Auto" />
      				<ColumnDefinition Width="*" />
      				
      			</Grid.ColumnDefinitions>
      			<Grid.RowDefinitions>
      				<RowDefinition Height="Auto" />
      				<RowDefinition Height="30" />
      				<RowDefinition Height="Auto" />
      			</Grid.RowDefinitions>
      			<Label Content="Customer name:" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" Padding="0" />
      			<Label Content="{Binding [CUNM]}" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" />
      			
      			<Label Content="Your reference 1:" Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0" Padding="0" />
      			<TextBox MaxLength="30" Text="{Binding [YREF]}" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" />
      			
      			<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,15,0,0" Grid.ColumnSpan="7">
      				<Button Content="{mashup:Constant Key=Save,File=Mango.UI}" Width="150" VerticalAlignment="Center">
      					<Button.CommandParameter>
      						<mashup:Events>
      							<mashup:Event TargetEventName="Update" TargetName="CustomerDetail" SourceEventName="Click" />
      
      						</mashup:Events>
      					</Button.CommandParameter>
      				</Button>
      			</StackPanel>
      		</Grid>
      	</m3:MIPanel>
      </Grid>
      

Comments are closed.