namespace CrowIDE
{
- public class PropertyContainer {
+ public class PropertyContainer : IBindable
+ {
+ public object DataSource {
+ get {
+ throw new NotImplementedException ();
+ }
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #region IBindable implementation
+ List<Binding> bindings = new List<Binding> ();
+ public List<Binding> Bindings {
+ get { return bindings; }
+ }
+ #endregion
+
PropertyInfo pi;
object instance;
public string Name { get { return pi.Name; }}
- public object Value { get { return pi.GetValue(instance); }}
+ public object Value {
+ get { return pi.GetValue(instance); }
+ set {
+ try {
+ if (pi.PropertyType != value.GetType() && pi.PropertyType != typeof(string)){
+ if (pi.PropertyType.IsEnum) {
+ pi.SetValue (instance, value);
+ } else {
+ MethodInfo me = pi.PropertyType.GetMethod
+ ("Parse", BindingFlags.Static | BindingFlags.Public,
+ System.Type.DefaultBinder, new Type [] {typeof (string)},null);
+ pi.SetValue (instance, me.Invoke (null, new object[] { value }), null);
+ }
+ }else
+ pi.SetValue(instance, value);
+ } catch (Exception ex) {
+ System.Diagnostics.Debug.WriteLine ("Error setting property:"+ ex.ToString());
+ }
+
+ }
+ }
+ public string Type { get { return pi.PropertyType.IsEnum ?
+ "System.Enum"
+ : pi.PropertyType.FullName; }}
+ public string[] Choices {
+ get {
+ return Enum.GetNames (pi.PropertyType);
+ }
+ }
public PropertyContainer(PropertyInfo prop, object _instance){
pi = prop;
</HorizontalStack>
</VerticalStack>
<Splitter/>
- <MembersView Width="20%" Instance="{../crowContainer.SelectedItem}">
- <ItemTemplate DataType="CrowIDE.PropertyContainer">
- <HorizontalStack Focusable="true" Height="Fit" Width="Stretched" Spacing="0"
+ <MembersView Width="20%" Instance="{../crowContainer.SelectedItem}" DataTest="Type">
+ <Template>
+ <Scroller Name="scroller1" Margin="1" VerticalScrolling="true"
+ ValueChanged="./_scroller_ValueChanged">
+ <VerticalStack LayoutChanged="./_list_LayoutChanged" Spacing="0"
+ Height="Fit" Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/>
+ </Scroller>
+ </Template>
+ <ItemTemplate>
+ <HorizontalStack Focusable="true" Height="Fit" Spacing="0"
+ MouseEnter="{Background=UnitedNationsBlue}"
+ MouseLeave="{Background=Transparent}" >
+ <Label Margin="1" Text="{Name}" Height="Fit" Width="50%"/>
+ <TextBox Margin="1" Text="{²Value}" Height="Fit" Width="50%"/>
+ </HorizontalStack>
+ </ItemTemplate>
+ <ItemTemplate DataType="System.Boolean">
+ <HorizontalStack Focusable="true" Height="Fit" Spacing="0"
+ MouseEnter="{Background=UnitedNationsBlue}"
+ MouseLeave="{Background=Transparent}" >
+ <Label Margin="1" Text="{Name}" Height="Fit" Width="50%"/>
+ <CheckBox Background="White" Margin="1" Caption="" IsChecked="{²Value}"/>
+ </HorizontalStack>
+ </ItemTemplate>
+- <ItemTemplate DataType="System.Enum">
+ <HorizontalStack Focusable="true" Height="Fit" Spacing="0"
MouseEnter="{Background=UnitedNationsBlue}"
MouseLeave="{Background=Transparent}" >
- <Border Height="Fit" Width="50%" Foreground="DimGray">
- <Label Margin="1" Text="{Name}" Height="Stretched" Width="Stretched"/>
- </Border>
- <Border Height="Fit" Width="50%" Foreground="DimGray">
- <TextBox Margin="1" Text="{Value}" Height="Stretched" Width="Stretched"/>
- </Border>
+ <Label Margin="1" Text="{Name}" Height="Fit" Width="50%"/>
+ <ComboBox Margin="1" Height="Fit" Width="50%" Data="{Choices}"
+ SelectedIndex="{²Value}">
+ <Template>
+ <Popper Name="popper" PopDirection="Bottom">
+ <Template>
+ <Border CornerRadius="0" Foreground="LightGray" Background="White">
+ <HorizontalStack Margin="0" Spacing="1">
+ <Label Width="Stretched" MinimumSize="80,10" Margin="1" Foreground="Black" Background="White"
+ Text="{../../../../SelectedItem}"/>
+ <Button Width="12" Height="12" Focusable="false"
+ Template="#Crow.Templates.ArrowButTemplate.crow">
+ <Image Margin="1" Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
+ </Button>
+ </HorizontalStack>
+ </Border>
+ </Template>
+ <Border Background="White" BorderWidth="1" Margin="1" Foreground="Black"
+ MinimumSize="{../../MinimumPopupSize}" Fit="true">
+ <Scroller Name="scroller1" Margin="2" VerticalScrolling="true"
+ MaximumSize="0,200"
+ HorizontalAlignment="Left"
+ ValueChanged="../../../_scroller_ValueChanged">
+ <VerticalStack LayoutChanged="../../../../_list_LayoutChanged"
+ MouseClick="../../../onMouseClick" Focusable="True"
+ Height="Fit" Name="ItemsContainer" Margin="0"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Top"/>
+ </Scroller>
+ </Border>
+ </Popper>
+ </Template>
+ <ItemTemplate>
+ <Container Fit="true" Margin="0" Focusable="true"
+ HorizontalAlignment="Left"
+ MouseEnter="{Background=SteelBlue}"
+ MouseLeave="{Background=Transparent}">
+ <Label Text="{}" Foreground="Black"/>
+ </Container>
+ </ItemTemplate>
+ </ComboBox>
</HorizontalStack>
</ItemTemplate>
</MembersView>