<EmbeddedResource Include="Images\Icons\checkbox.svg" />
<EmbeddedResource Include="Images\Icons\radiobutton.svg" />
<EmbeddedResource Include="Templates\Spinner %28copier%29.goml" />
- <EmbeddedResource Include="Templates\ItemTemplate.goml" />
<EmbeddedResource Include="Images\Icons\expandable.svg" />
<EmbeddedResource Include="Templates\Checkbox2.goml" />
<EmbeddedResource Include="Images\Icons\tetra.png" />
<LogicalName>Crow.DockingView.template</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="Templates\FileItems.template" />
+ <EmbeddedResource Include="Templates\DefaultItem.template">
+ <LogicalName>Crow.DefaultItem.template</LogicalName>
+ </EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="Crow.dll.config">
--- /dev/null
+<?xml version="1.0"?>
+<Container Fit="true" Margin="0" Focusable="true"
+ HorizontalAlignment="Left"
+ MouseEnter="{Background=SteelBlue}"
+ MouseLeave="{Background=Transparent}">
+ <Label Text="{}"/>
+</Container>
+
+++ /dev/null
-<?xml version="1.0"?>
-<Container Fit="true" Margin="0" Focusable="true"
- HorizontalAlignment="Left"
- MouseEnter="{Background=SteelBlue}"
- MouseLeave="{Background=Transparent}">
- <Label Text="{}"/>
-</Container>
-
///
/// ItemTemplate file may contains either a single template without the
/// ItemTemplate enclosing tag, or several item templates each enclosed
- /// in a separate tag
+ /// in a separate tag.
/// </summary>
- [XmlAttributeAttribute][DefaultValue("#Crow.Templates.ItemTemplate.goml")]
+ [XmlAttributeAttribute]
public string ItemTemplate {
get { return _itemTemplate; }
set {
}
string getItempKey(Type dataType, object o){
try {
- return dataType.GetProperty (_dataTest).GetGetMethod ().Invoke (o, null).ToString();
+ return dataType.GetProperty (_dataTest).GetGetMethod ().Invoke (o, null)?.ToString();
} catch {
return dataType.FullName;
}
public bool HasTemplate {
get { return typeof (TemplatedControl).IsAssignableFrom (CrowType);}
}
+ public bool IsTemplatedGroup {
+ get { return typeof (TemplatedGroup).IsAssignableFrom (CrowType);}
+ }
public static implicit operator string (Node sn)
{
/// </summary>
/// <returns>the string triplet dataType, itemTmpID read as attribute of this tag</returns>
/// <param name="reader">current xml text reader</param>
- /// /// <param name="itemTemplatePath">file containing the templates if its a dedicated one</param>
+ /// <param name="itemTemplatePath">file containing the templates if its a dedicated one</param>
string[] parseItemTemplateTag (XmlReader reader, string itemTemplatePath = "") {
string dataType = "default", datas = "", path = "";
while (reader.MoveToNextAttribute ()) {
}
}
}
+ if (!ctx.nodesStack.Peek ().IsTemplatedGroup)
+ return;
+ //add the default item template if no default is defined
+ if (!itemTemplateIds.Any(ids=>ids[0] == "default"))
+ itemTemplateIds.Add (new string [] { "default", "#Crow.DefaultItem.template", "" });
//copy item templates (review this)
foreach (string [] iTempId in itemTemplateIds) {
ctx.il.Emit (OpCodes.Ldloc_0);//load TempControl ref
}
static void loadCursors(){
//Load cursors
- XCursor.Cross = XCursorFile.Load("#Crow.Images.Icons.Cursors.cross").Cursors[3];
- XCursor.Default = XCursorFile.Load("#Crow.Images.Icons.Cursors.arrow").Cursors[3];
- XCursor.NW = XCursorFile.Load("#Crow.Images.Icons.Cursors.top_left_corner").Cursors[3];
+ XCursor.Cross = XCursorFile.Load("#Crow.Images.Icons.Cursors.cross").Cursors[0];
+ XCursor.Default = XCursorFile.Load("#Crow.Images.Icons.Cursors.arrow").Cursors[0];
+ XCursor.NW = XCursorFile.Load("#Crow.Images.Icons.Cursors.top_left_corner").Cursors[0];
XCursor.NE = XCursorFile.Load("#Crow.Images.Icons.Cursors.top_right_corner").Cursors[0];
XCursor.SW = XCursorFile.Load("#Crow.Images.Icons.Cursors.bottom_left_corner").Cursors[0];
XCursor.SE = XCursorFile.Load("#Crow.Images.Icons.Cursors.bottom_right_corner").Cursors[0];
/// <summary>
/// Derived from Instantiator with sub data fetching facilities for hierarchical data access.
+ ///
+ /// ItemTemplate stores the dynamic method for instantiating the control tree defined in a valid IML file.
+ ///
/// </summary>
public class ItemTemplate : Instantiator {
public EventHandler Expand;
string fetchMethodName;
#region CTOR
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Crow.ItemTemplate"/> class by parsing the file passed as argument.
+ /// </summary>
+ /// <param name="path">IML file to parse</param>
+ /// <param name="_dataType">type this item will be choosen for, or member of the data item</param>
+ /// <param name="_fetchDataMethod">for hierarchical data, method to call for children fetching</param>
public ItemTemplate(string path, string _dataType = null, string _fetchDataMethod = null)
: base(path) {
strDataType = _dataType;
fetchMethodName = _fetchDataMethod;
}
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Crow.ItemTemplate"/> class by parsing the IML fragment passed as arg.
+ /// </summary>
+ /// <param name="path">IML fragment to parse</param>
+ /// <param name="_dataType">type this item will be choosen for, or member of the data item</param>
+ /// <param name="_fetchDataMethod">for hierarchical data, method to call for children fetching</param>
public ItemTemplate (Stream ImlFragment, string _dataType, string _fetchDataMethod)
:base(ImlFragment)
{
strDataType = _dataType;
fetchMethodName = _fetchDataMethod;
}
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Crow.ItemTemplate"/> class using the opened XmlReader in args.
+ /// </summary>
+ /// <param name="path">XML reader positionned before or at the root node</param>
+ /// <param name="_dataType">type this item will be choosen for, or member of the data item</param>
+ /// <param name="_fetchDataMethod">for hierarchical data, method to call for children fetching</param>
public ItemTemplate (XmlReader reader, string _dataType = null, string _fetchDataMethod = null)
:base(reader)
{
}
#endregion
+ /// <summary>
+ /// Creates the expand delegate.
+ /// </summary>
+ /// <param name="host">Host.</param>
public void CreateExpandDelegate (TemplatedGroup host){
Type dataType = CompilerServices.tryGetType(strDataType);
if (dataType == null) {