List style - more than 4 textboxes?

Jun 28, 2013 at 7:59 PM
Markus,
I am going to be going through the link you gave on styles, but have a specific question that I thought I would ask in case the answer isn't in those docs. If it is, ignore this for now.

I am using the List style:
<Style x:Key="myListStyle" TargetType="ListBox" BasedOn="{StaticResource Battleship-Control-ListBox}">
    <Setter Property="ItemTemplate" Value="{DynamicResource CODE.Framework-StandardTemplate-LargeText01}" />
</Style>
This looks for Text1, Text2, etc. and automatically uses that to show the data. Very nice. But it seems to be limited to 4 text boxes and I need more.

I would assume that I just need to find the appropriate code change it to add 4 more textboxes. But it may be more complicated that appears on the surface, so I thought I would ask about it. That way, if it's not covered, I won't have to wait that much longer to get an answer... :)

Thanks,

Fletcher
Jun 29, 2013 at 2:47 AM
Markus,

Ok, No need to answer, I found it.

Are there any docs on the templates that would help me? I know there is a link on the website that shows many of the metro templates, but none of the others.

But, if I look in xxxxStandardFeatures.cs in the xxxxStandardViewFactory method, I can see all the possible formats that are supported. So I just found one that had at least 8 textboxes and that works.

But if you have any links to docs on the differences (besides the # of columns supported) for the various themes, that would be cool.

Thanks,

Fletcher
Coordinator
Jul 1, 2013 at 8:52 PM
We are behind on that, but it's the goal to add the same docs as we have for the Metro standard templates for all the other themes. (Damn docs always take forever to do... longer than the actual dev in many cases :-().

Markus
Jul 8, 2013 at 11:40 PM
Markus,

I know I have touched on this in other questions, but I don't think I have found an answer.

In your List view template code, you check the view for fields like Text1, Text2, etc. in the model and, if found, automatically create columns for them. This is very nice.

I am trying to figure out what I set so that the correct header is shown. Do I use something like Test1Header {get;set;}? Or supply them some other way?

Thanks,

Fletcher
Coordinator
Jul 12, 2013 at 12:46 AM
You can just define the columns either in the resource dictionary, or right in line in your listbox definition:
<ListBox ItemsSource="{Binding MyData}">
  <c:ListEx.Columns>
    <c:ListColumnsCollection>
      <c:ListColumn BindingPath="Text1" Header="My Great Caption" IsResizable="True" Width="200" />
      <c:ListColumn BindingPath="Text2" Header="My Other Caption" IsResizable="True" Width="100" />
    </c:ListColumnsCollection>
  </c:ListEx.Columns>
</ListBox>
This way, the columns will only apply if a style is chosen that utilizes the columns. If that is the case however, it will use the specified settings for the columns. You can change things like captions, width, whether the column is resizable, and so on.


Markus