-<Border Background="DimGray" BorderWidth="1" Margin="1" MinimumSize="100,100"
- Width="{../WidthPolicy}" Height="{../HeightPolicy}">
- <VerticalStack Width="{../../WidthPolicy}" Height="{../../HeightPolicy}"
- Name="List" Margin="0" VerticalAlignment="Top"/>
-
+<Border BorderWidth="1" Margin="1" MinimumSize="10,10" Height="{../HeightPolicy}" Width="{../WidthPolicy}" >
+ <Scroller Name="scroller1" Margin="1" VerticalScrolling="true"
+ Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"
+ ValueChanged="../../_scroller_ValueChanged">
+ <VerticalStack LayoutChanged="../../../_list_LayoutChanged"
+ Height="Fit" Width="{../../../WidthPolicy}" Name="List" Margin="0" VerticalAlignment="Top"/>
+ </Scroller>
</Border>
<?xml version="1.0"?>
<TreeView Height="90%" Width="90%" Data="{CurDirectory}">
<ItemTemplate DataType="System.IO.FileInfo">
- <Label Background="Mantis" Text="{Name}" Width="Stretched"/>
-<!-- <Expandable Caption="{}">
- <Template>
- <Border BorderWidth="1" Foreground="LightGray" Height="{../HeightPolicy}" Width="{../WidthPolicy}"
- MouseClick="../onMouseClick">
- <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
- <HorizontalStack Spacing="1" Height="Fit" Width="{../../../WidthPolicy}">
- <Image Margin="2" Width="12" Height="12" Path="{../../../../Image}" SvgSub="{../../../../SvgSub}"/>
- <Label Text="{../../../../Caption}" Width="{../../../../WidthPolicy}"/>
- </HorizontalStack>
- <Container Name="Content" Visible="false" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
- </VerticalStack>
- </Border>
- </Template>
- </Expandable>-->
+ <Label Text="{Name}" Width="Stretched"/>
</ItemTemplate>
<ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetFileSystemInfos">
<Expandable Caption="{Name}" >
<Template>
<VerticalStack Height="{../HeightPolicy}" Width="{../WidthPolicy}">
- <HorizontalStack Spacing="1" Height="-1" Width="{../../WidthPolicy}">
+ <HorizontalStack Spacing="1" Height="Fit" Width="{../../WidthPolicy}">
<Image Margin="2" Width="12" Height="12"
Visible="{../../../HasContent}"
Path="{../../../Image}"
<Label Text="{../../../Caption}" Width="{../../../WidthPolicy}"/>
</HorizontalStack>
<Container Name="Content" Visible="false"
- Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
+ Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
</VerticalStack>
</Template>
- <ListBox Name="List" Height="Fit" Width="{../WidthPolicy}" />
+ <HorizontalStack Height="Fit" Width="{../WidthPolicy}">
+ <GraphicObject Width="12" Height="10"/>
+ <ListBox Name="List" Height="Fit" Width="{../../WidthPolicy}"
+ Template="#Tests.Interfaces.treeList.crow" />
+ </HorizontalStack>
</Expandable>
</ItemTemplate>
</TreeView>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0"?>
+<VerticalStack
+ Height="Fit" Width="{../WidthPolicy}" Name="List"/>
\ No newline at end of file
<EmbeddedResource Include="ui\Popper.template" />
<EmbeddedResource Include="ui\MenuItem.style" />
<EmbeddedResource Include="test.style" />
+ <EmbeddedResource Include="Interfaces\treeList.crow" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Crow.csproj">
}
#endregion
void loading(){
- if (itemTemplates == null)
- itemTemplates = new Dictionary<string, ItemTemplate> ();
- if (!itemTemplates.ContainsKey ("default"))
- itemTemplates["default"] = new ItemTemplate (ItemTemplate);
+ if (ItemTemplates == null)
+ ItemTemplates = new Dictionary<string, ItemTemplate> ();
+ if (!ItemTemplates.ContainsKey ("default"))
+ ItemTemplates["default"] = new ItemTemplate (ItemTemplate);
for (int i = 1; i <= (data.Count / itemPerPage) + 1; i++) {
if (cancelLoading)
ItemTemplate itemStream = null;
Type dataType = data [i].GetType ();
- if (itemTemplates.ContainsKey (dataType.FullName))
- itemStream = itemTemplates [dataType.FullName];
+ if (ItemTemplates.ContainsKey (dataType.FullName))
+ itemStream = ItemTemplates [dataType.FullName];
else
- itemStream = itemTemplates ["default"];
+ itemStream = ItemTemplates ["default"];
lock (Interface.CurrentInterface.LayoutMutex) {
g = Interface.Load (itemStream);
string _template;
string _itemTemplate;
- protected Dictionary<string, ItemTemplate> itemTemplates;
+ public Dictionary<string, ItemTemplate> ItemTemplates;
[XmlAttributeAttribute][DefaultValue(null)]
public string Template {
xr.MoveToElement ();
itemTmp = xr.ReadInnerXml ();
- if (itemTemplates == null)
- itemTemplates = new Dictionary<string, ItemTemplate> ();
+ if (ItemTemplates == null)
+ ItemTemplates = new Dictionary<string, ItemTemplate> ();
//TODO:check encoding
- itemTemplates[dataType] = new ItemTemplate (Encoding.UTF8.GetBytes(itemTmp));
+ ItemTemplates[dataType] = new ItemTemplate (Encoding.UTF8.GetBytes(itemTmp));
if (!string.IsNullOrEmpty (datas))
- itemTemplates [dataType].CreateExpandDelegate(dataType, datas);
+ ItemTemplates [dataType].CreateExpandDelegate(this, dataType, datas);
continue;
}
public ItemTemplate(Byte[] b)
: base(b){}
- public void CreateExpandDelegate (string strDataType, string method){
+ public void CreateExpandDelegate (TemplatedControl host, string strDataType, string method){
Type dataType = Type.GetType(strDataType);
- Type hostType = typeof(ItemTemplate);//not sure is the best place to put the dyn method
+ Type hostType = typeof(TemplatedControl);//not sure is the best place to put the dyn method
Type evtType = typeof(EventHandler);
Type listBoxType = typeof(ListBox);
#region IL generation
ILGenerator il = dm.GetILGenerator (256);
+ il.DeclareLocal(typeof(GraphicObject));
il.Emit (OpCodes.Ldarg_1);
MethodInfo miFindByName = typeof(GraphicObject).GetMethod("FindByName");
il.Emit(OpCodes.Ldstr, "List");
il.Emit (OpCodes.Callvirt, miFindByName);
+ il.Emit (OpCodes.Stloc_0);
+ FieldInfo fiTemplates = typeof(TemplatedControl).GetField("ItemTemplates");
+ il.Emit (OpCodes.Ldloc_0);
+ il.Emit (OpCodes.Ldarg_0);
+ il.Emit (OpCodes.Ldfld, fiTemplates);
+ il.Emit (OpCodes.Stfld, fiTemplates);
+
+ il.Emit (OpCodes.Ldloc_0);
il.Emit (OpCodes.Ldarg_1);
il.Emit (OpCodes.Callvirt, typeof(GraphicObject).GetProperty("DataSource").GetGetMethod ());
#endregion
- Expand = (EventHandler)dm.CreateDelegate (evtType, this);
+ Expand = (EventHandler)dm.CreateDelegate (evtType, host);
}
}
}