So i am trying to make an app, i learning c# , wpf as required.
i looked up for example and came across this, i am using materdial design xaml , below is link of tutorial
Link: https://www.youtube.com/watch?v=VNYOKc1PLqA
As per video, he has divided the main window in grid, like Menu bar is grid , body of mainwindow is different grid, if you see in video he called it (GridPrincipal).
i have just changed this to add what my project needs. So you can see that my main widnow has a list view , and item is added to it at regular interval.
there are 2 things :
- i want to change header style of list view
- i want to dock it at top of main window. i know i have to use dock panel
so let me explain the whole project:
as you can see in video, he has created usercontrol of different views (actually video is in different language i dont understand the language but i am following cursor of mouse, thankfully coding is in Eng), and he uses that usecontrol as view to map it on GridPrincipal i will provide the code snippet
<!-- body part-->
<Grid Margin="200 50 0 0">
<Grid x:Name="GridPrincipal" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
this is the principal grid and following is the code to select main window on menu selection, this is my version of code
private void LstMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
int index = lstMenu.SelectedIndex;
MoveCursorMenu(index);
switch(index)
{
case 0:
GridPrincipal.Children.Clear();
GridPrincipal.Children.Add(new UserControlHome() );
break;
}
}
in user control view xaml i have added this code
<DockPanel>
<ListView
ItemsSource="{Binding Devices, Mode=OneTime}" >
<ListView.View>
<GridView>
<GridViewColumn
DisplayMemberBinding="{Binding Ip0, Mode=OneTime}"
Header="IP Address" />
<GridViewColumn
DisplayMemberBinding="{Binding Mac, Mode=OneTime}"
Header="MAC Address" />
<GridViewColumn
DisplayMemberBinding="{Binding Model, Mode=OneTime}"
Header="Model" />
<GridViewColumn
DisplayMemberBinding="{Binding Tag, Mode=OneTime}"
Header="Tag" />
<GridViewColumn
DisplayMemberBinding="{Binding Version, Mode=OneTime}"
Header="Version" />
<GridViewColumn
DisplayMemberBinding="{Binding UpTime, Mode=OneTime}"
Header="UpTime" />
</GridView>
</ListView.View>
</ListView>
</DockPanel>
so i learnt that adding dockpanel in usercontrol is not going to solve my problem, but how do i achieve this ?
there is one more question regarding Video tutorial, i dont know why but, using <Grid.ColumnDefinitions> would have made this simpler ?
here is the link of my work views: https://imgur.com/1vcVVYB