Want to create a listview by Extending the The listview control. I have to create a unique style for my custom listview. The problem I am facing is
when am putting a gridview to arrange the data, the style that i applied will loss and it wil look like the ordinary listview.
Here i am displaying some of the sample that i tried.
In the Xaml file where i designed my listview
<Style TargetType="{x:Type local:GOGWPFAdvancedListView}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:GOGWPFAdvancedListView}">
<Border removed="LightBlue"
BorderBrush="Blue"
BorderThickness="10">
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
I Extended a class for my listview
public class GOGWPFAdvancedListView : System.Windows.Controls.ListView
{
static GOGWPFAdvancedListView()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(GOGWPFAdvancedListView), new System.Windows.FrameworkPropertyMetadata(typeof(GOGWPFAdvancedListView)));
}
}
In my Consuming Page
xmlns:Advanced="clr-namespace:GOGWPFAdvancedListView;assembly=GOGWPFAdvancedListView"
when i put only the new control its style is visible
<advanced:gogwpfadvancedlistview name="lvMainlist" >
</advanced:gogwpfadvancedlistview>
But when i put a gridview to the listview it wil look like the ordinary listview
<advanced:gogwpfadvancedlistview name="lvMainlist" >
<advanced:gogwpfadvancedlistview.view>
<gridview>
<gridviewcolumn header="Name" width="100" displaymemberbinding="{Binding Name}" />
<gridviewcolumn header="Place" width="100" displaymemberbinding="{Binding Place}" />
<gridviewcolumn header="Country" width="100" displaymemberbinding="{Binding Country}" />
<gridviewcolumn header="State" width="100" displaymemberbinding="{Binding State}" />
<gridviewcolumn header="Age" width="100" displaymemberbinding="{Binding Age}" />
<gridviewcolumn header="C/O" width="100" displaymemberbinding="{Binding CO}" />
<gridviewcolumn header="JOB" width="100" displaymemberbinding="{Binding JOB}" />
</gridview>
</advanced:gogwpfadvancedlistview.view>
</advanced:gogwpfadvancedlistview>
Any suggestions???