Forums

Resources
Last Post 17 Mar 2018 01:32 PM by hiergibtesdrachen. 4 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
hiergibtesdrachenUser is Offline
New Member
New Member
Posts:6


--
14 Mar 2018 06:18 AM
    1. Is it possible to improve your generator using parts of the control (file) -name for the resource methods?


    private static void InitializeElementbuildingslistResources(UIElement elem)...

    --> private static UIElement r_0_dtMethod(UIElement parent)...

    private static UIElement r_1_dtMethod(UIElement parent)...

    private static void InitializeElementdetailesResources(UIElement elem)...

    --> private static UIElement r_0_dtMethod(UIElement parent)...

    as you can see your generator using the same names for the functions...

    for example:

    Grid e0 = ...

    private static UIElement e0_r0_DataTemplate(UIElement parent) ...

    or

    private static UIElement e0_r0_dtMethod(UIElement parent) ...

    or something like that? Im not sure why u using the "Method" postfix for your parsing, but well this isnt the important part <img src='http://emptykeys.com/DesktopModules/ActiveForums/themes/_default/emoticons/smile.gif' align="absmiddle" border="0" class="afEmoticon" />


    2. How about DataTemplateSelector features and string keys for ResourceDictionary Resources?


    # Edit
    i kinda solved number 1 myself: https://github.com/EmptyKeys/UI_Generator/pull/21

    Filip DušekUser is Offline
    Advanced Member
    Advanced Member
    Posts:695


    --
    14 Mar 2018 07:13 PM
    I see, thanks for pull request. I will add it to the next version
    hiergibtesdrachenUser is Offline
    New Member
    New Member
    Posts:6


    --
    15 Mar 2018 02:12 AM
    Your UI is greate, but u really need to fix the resource keys from Type to string...
    u losing so much functionality becouse of it. i dont know the reason why u using the types can u tell me pls ?
    Filip DušekUser is Offline
    Advanced Member
    Advanced Member
    Posts:695


    --
    15 Mar 2018 06:55 PM
    Not sure what you mean, i use string resource keys everywhere (localization etc). Make me some example, what is not working for you.
    hiergibtesdrachenUser is Offline
    New Member
    New Member
    Posts:6


    --
    17 Mar 2018 01:32 PM
    its not like something is not working
    im talking about to improve your generator.

    actually your generator is using the type (DataType) of the DataTemplate resource for the DictionaryKey.
    if it would be possible to change the keyType to a string and implement Datatemplateselector freatures your ui would rock a bit more ^^

    the DataTemplateSelector could raise an UIRoot event with the UIElement and Type of the item in eventargs, so it would be possible to search with this parameters for
    a DataTemplate.

    1. private static void InitializeElementbuildingslistResources(UIElement elem) {
    2. // Resource - [DataTemplateKey(Lota.GameData.BuildingInfo)] DataTemplate
    3. Func<UIElement, UIElement> buildingslist_r0_dtFunc = buildingslist_r0_dtMethod;
    4. elem.Resources.Add(typeof(Lota.GameData.BuildingInfo), new DataTemplate(typeof(Lota.GameData.BuildingInfo), buildingslist_r0_dtFunc));
    5. // Resource - [DataTemplateKey(Lota.GameData.EpochTreeView)] DataTemplate
    6. Func<UIElement, UIElement> buildingslist_r1_dtFunc = buildingslist_r1_dtMethod;
    7. elem.Resources.Add(typeof(Lota.GameData.EpochTreeView), new DataTemplate(typeof(Lota.GameData.EpochTreeView), buildingslist_r1_dtFunc));
    8. // Resource - [DataTemplateKey(Lota.GameData.TreeViewItem)] DataTemplate
    9. Func<UIElement, UIElement> buildingslist_r2_dtFunc = buildingslist_r2_dtMethod;
    10. elem.Resources.Add(typeof(Lota.GameData.TreeViewItem), new DataTemplate(typeof(Lota.GameData.TreeViewItem), buildingslist_r2_dtFunc));

    u just needed to change the lines 4,7,10 to

    4. elem.Resources.Add(typeof(Lota.GameData.BuildingInfo).ToString(), new DataTemplate(typeof(Lota.GameData.BuildingInfo), buildingslist_r0_dtFunc));
    7. elem.Resources.Add(typeof(Lota.GameData.EpochTreeView).ToString(), new DataTemplate(typeof(Lota.GameData.EpochTreeView), buildingslist_r1_dtFunc));
    10. elem.Resources.Add(typeof(Lota.GameData.TreeViewItem).ToString(), new DataTemplate(typeof(Lota.GameData.TreeViewItem), buildingslist_r2_dtFunc));

    and the parts of code where the ui selects the Datatemplates.

    x:Key Property parsing and Type.ToString() if no x:Key is given, should be possible i think ?

    Benefits:
    1. Different DataTemplates for same Types in one Dictionary.with different level of details
    2. Flexibility
    3. More generic

    sorry for my ugly englisch
    You are not authorized to post a reply.