反正就是总结(2019.06.01)
1.DataGrid用法(用的metrol)
<DataGrid AutoGenerateColumns="False" IsReadOnly="True" SelectedItem="{Binding}" ItemsSource="{Binding }">
<DataGrid.Columns>
<DataGridTemplateColumn >
<DataGridTemplateColumn.HeaderTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding DataContext., RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" />
</DataTemplate>
</DataGridTemplateColumn.HeaderTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox HorizontalAlignment="Center" VerticalAlignment="Center" IsChecked="{Binding , UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn ElementStyle="{StaticResource}" Header="1" Binding="{Binding }" ></DataGridTextColumn>
<DataGridTextColumn ElementStyle="{StaticResource}" Header="2" Binding="{Binding}"></DataGridTextColumn>
<DataGridTextColumn ElementStyle="{StaticResource}" Header="3" Binding="{Binding}" ></DataGridTextColumn>
<DataGridTextColumn ElementStyle="{StaticResource}" Header="4" Binding="{Binding}"></DataGridTextColumn>
<DataGridTemplateColumn Header="5">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Button ToolTip="" Style="{StaticResource}" Width="35" CommandParameter="{Binding}" Command="{Binding DataContext., RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}">
<Rectangle Width="25" VerticalAlignment="Center" Height="25" Fill="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}">
<Rectangle.OpacityMask>
<VisualBrush Stretch="Uniform" Visual="{StaticResource appbar_steam}"/>
</Rectangle.OpacityMask>
</Rectangle>
</Button>
<Button ToolTip="" Style="{StaticResource}" Width="25" Height="25" CommandParameter="{Binding}" Command="{Binding DataContext., RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" Margin="5,0,0,0">
<Rectangle Width="25" VerticalAlignment="Center" Height="25" Fill="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}">
<Rectangle.OpacityMask>
<VisualBrush Stretch="Uniform" Visual="{StaticResource appbar_delete}"/>
</Rectangle.OpacityMask>
</Rectangle>
</Button>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
2.GridSplitter 允许用户拉动
<GridSplitter Grid.Column="1" ResizeDirection="Columns" HorizontalAlignment="Stretch" Grid.Row="0" BorderThickness="3" BorderBrush="Black"/>
3.TabItem 用法
<Controls:MetroAnimatedSingleRowTabControl Margin="0" Grid.Row="2" Style="{Binding Mode=OneWay, Source={StaticResource}}">
<TabItem Header="曲线" Controls:TabControlHelper.IsUnderlined="True" >
<DataTemplate>
<UC:StackedColumnChartControl DataContext="{Binding}"></UC:StackedColumnChartControl>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</TabItem>
<TabItem Header="" Controls:TabControlHelper.IsUnderlined="True" >
</TabItem>
</Controls:MetroAnimatedSingleRowTabControl>
4.App.xml 和app.config 属于全局
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type Button}" x:Key="MyButton">
<Setter Property="Background" Value="Black">
</Setter>
<Setter Property="FontSize" Value="18">
</Setter>
<Setter Property="Foreground" Value="White">
</Setter>
</Style>
</ResourceDictionary>
</Application.Resources>
<Button Width="50" Height="30" Command="{Binding}" Style="{StaticResource MyButton}">Test</Button>
<configuration>
<appSettings>
<add key="connectionstring" value="User ID=sa;Data Source=.;Password=;Initial Catalog=test;Provider=SQLOLEDB.1;"/>
<add key="TemplatePATH" value="Template"/>
</appSettings>
</configuration>
return ConfigurationManager.AppSettings["Url4BaseVersion"];
https://blog.csdn.net/xpj8888/article/details/83617875这篇写的不错