Custom control instance picker not binding to defined type projection

I am trying to create a sample project with following scenario:

A DataBank CI class which holds information about databases. This class is defined like this:

<ClassType ID="BIPCAssetClass.DataBank" Accessibility="Public" Abstract="false" Base="System!System.ConfigItem" Hosted="false" Singleton="false" Extension="false">
          <Property ID="DataBankID" Type="string" AutoIncrement="true" Key="true" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false" Scale="0" DefaultValue="DataBank{0}" />
          <Property ID="DataBankType" Type="enum" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false" Scale="0" EnumType="Enum.DataBankType" />
          <Property ID="DataBankVersion" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false" Scale="0" />
          <Property ID="DataBankUsage" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false" Scale="0" />
        </ClassType>


We may define a relation between this class and the computer where this database is installed on:

<RelationshipTypes>
        <RelationshipType ID="IsInstalledOnComputer" Accessibility="Public" Abstract="false" Base="System!System.Reference">
          <Source ID="Source_b67394ed_491b_43eb_a972_d8d0b8380aa2" MinCardinality="0" MaxCardinality="2147483647" Type="BIPCAssetClass.DataBank" />
          <Target ID="Target_6132fa12_af98_4bb8_96ca_e039e7067682" MinCardinality="0" MaxCardinality="1" Type="System!System.Computer" />
        </RelationshipType>
      </RelationshipTypes>


In order to make the user control save the relation, we may create a type projection like this:

<TypeProjections>
        <TypeProjection ID="Projection.DataBank" Accessibility="Public" Type="BIPCAssetClass.DataBank">
          <Component Path="$Context/Path[Relationship='IsInstalledOnComputer']$" Alias="DataBankInstalledOnComputer" />
        </TypeProjection>
      </TypeProjections>


So, in the Form Element, we reference this "Projection.DataBank" like this:

<Form ID="BIPCDataBank" Accessibility="Public" Target="Alias_f25ad0af_50e2_46ca_b7c7_46c2abb3303f!Projection.DataBank" Assembly="BIPCAssets" TypeName="BIPCAssets.DataBank">
        <Category>Form</Category>
      </Form>

and the target refers to the sealed MP where TypeProjection is defined:

<Reference Alias="Alias_f25ad0af_50e2_46ca_b7c7_46c2abb3303f">
        <ID>BIPC.Asset.DataBank</ID>
        <Version>1.0.0.1</Version>
        <PublicKeyToken>7a1fbae719247839</PublicKeyToken>
      </Reference>

Then after importing in the console, create a view referencing the class 

BIPCAssetClass.DataBank

Meanwhile in the usercontrol, we have the following binding:

<smcontrols:SingleInstancePicker Instance="{Binding Path=System.Computer, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                         BaseClassId="B4A14FFD-52C8-064F-C936-67616C245B35" Margin="5,0,10,0" 
                                                         MouseDoubleClick="SingleInstancePicker_MouseDoubleClick"/>

Though neither binding, nor Mouse double click works. He code for MouseDoubleClick is like this:

private void SingleInstancePicker_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            SingleInstancePicker singleInstancePicker = (SingleInstancePicker)sender;
            FormUtilities.Instance.PopoutForm(singleInstancePicker.Instance);
        }

What I have done wrong? Please point me to the right direction.

Thanks

April 27th, 2015 3:16pm

Your SingleInstancePicker's binding path should be "DataBankInstalledOnComputer"

Your form is bound to your type projection. That means you can use properties of the classes referenced in the type projection and the aliases for your components as your binding path.

I'm not sure what you mean when you say "mouse double click" is not working..do you mean the event handler is not firing? If that's the case, you have some problem with your XAML and/or code-behind.

Free Windows Admin Tool Kit Click here and download it now
April 27th, 2015 4:01pm

Your SingleInstancePicker's binding path should be "DataBankInstalledOnComputer"

Your form is bound to your type projection. That means you can use properties of the classes referenced in the type projection and the aliases for your components as your binding path.

I'm not sure what you mean when you say "mouse double click" is not working..do you mean the event handler is not firing? If that's the case, you have some problem with your XAML and/or code-behind.

  • Proposed as answer by Rob.FordModerator Monday, April 27, 2015 9:49 PM
  • Marked as answer by YSobhdel Tuesday, April 28, 2015 1:18 AM
April 27th, 2015 7:58pm

Your SingleInstancePicker's binding path should be "DataBankInstalledOnComputer"

Your form is bound to your type projection. That means you can use properties of the classes referenced in the type projection and the aliases for your components as your binding path.

I'm not sure what you mean when you say "mouse double click" is not working..do you mean the event handler is not firing? If that's the case, you have some problem with your XAML and/or code-behind.

  • Proposed as answer by Rob.FordModerator Monday, April 27, 2015 9:49 PM
  • Marked as answer by YSobhdel Tuesday, April 28, 2015 1:18 AM
Free Windows Admin Tool Kit Click here and download it now
April 27th, 2015 7:58pm

Your SingleInstancePicker's binding path should be "DataBankInstalledOnComputer"

Your form is bound to your type projection. That means you can use properties of the classes referenced in the type projection and the aliases for your components as your binding path.

I'm not sure what you mean when you say "mouse double click" is not working..do you mean the event handler is not firing? If that's the case, you have some problem with your XAML and/or code-behind.

  • Proposed as answer by Rob.FordModerator Monday, April 27, 2015 9:49 PM
  • Marked as answer by YSobhdel Tuesday, April 28, 2015 1:18 AM
April 27th, 2015 7:58pm

Your SingleInstancePicker's binding path should be "DataBankInstalledOnComputer"

Your form is bound to your type projection. That means you can use properties of the classes referenced in the type projection and the aliases for your components as your binding path.

I'm not sure what you mean when you say "mouse double click" is not working..do you mean the event handler is not firing? If that's the case, you have some problem with your XAML and/or code-behind.

  • Proposed as answer by Rob.FordModerator Monday, April 27, 2015 9:49 PM
  • Marked as answer by YSobhdel Tuesday, April 28, 2015 1:18 AM
Free Windows Admin Tool Kit Click here and download it now
April 27th, 2015 7:58pm

Your SingleInstancePicker's binding path should be "DataBankInstalledOnComputer"

Your form is bound to your type projection. That means you can use properties of the classes referenced in the type projection and the aliases for your components as your binding path.

I'm not sure what you mean when you say "mouse double click" is not working..do you mean the event handler is not firing? If that's the case, you have some problem with your XAML and/or code-behind.

  • Proposed as answer by Rob.FordModerator Monday, April 27, 2015 9:49 PM
  • Marked as answer by YSobhdel Tuesday, April 28, 2015 1:18 AM
April 27th, 2015 7:58pm

Thanks for your reply, as soon as I corrected the binding, the MouseDoubleClick worked as expected.
Free Windows Admin Tool Kit Click here and download it now
April 27th, 2015 9:21pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics