How do I control the whole cell in a list power (with a GridView)? I have played with different qualities, but it always has control of the least size.
Here's my xaml.
& lt; Window x: class = "listviewUUSAR controllitist.info1" Xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: x = "http://schemas.microsoft.com/ Winfx / 2006 / xaml "xmlns: local =" clr-namespace: list vusar controltest "title =" window 1 "height =" 300 "width =" 300 "& gt; & Lt; Window.Resources & gt; & Lt; DataTemplate x: key = "UserControlCell" & gt; & Lt; Fill Rectangle = "Red" Horizontal Alignment = "Stretch" Minimum = "10" Minhite = "10" /> & Lt; / DataTemplate & gt; & Lt; /Window.Resources> & Lt; Grid & gt; & Lt; ListView Name = "MyListView" & gt; & Lt; ListView.View & gt; & Lt; GridView & gt; & Lt; GridViewColumn Width = "30" header = "Col1" DisplayMemberBinding = "{binding name}" /> & Lt; GridViewColumn Width = "200" header = "Col2" cell template = "{static resource userControlCell}" /> & Lt; / GridView & gt; & Lt; /ListView.View> & Lt; / ListView & gt; & Lt; / Grid & gt; Edit Sorry I changed the question because I had ended the user control as a source of the problem. It happens with any control.
After narrowing my question I was about Google and found it.
In fact for some reasons the ListViewItems are set to align the left. This problem is solved by dragging them into such a style:
& gt; Style target type = "listviewItem" & gt; & Lt; Setter property = "horizontal content alignment" value = "statch" /> & Lt; / Style & gt;
This unfortunately affects every column, but then you can set the contents of other columns on the left, right, center as explained in the link.
Comments
Post a Comment