WPF + DevExpress学习01

使用 DevExpress 初始化启动界面修改

 在 App.cs 文件下使用 SplashScreenManager
  public App() 
        {
          
            ApplicationThemeHelper.UpdateApplicationThemeName();

             SplashScreenManager.CreateThemed(new DXSplashScreenViewModel
             {
                 Status = "加载中...",
                 Title = "小豪博客!",
                 Copyright="深圳市@小豪科技",
                
             }).ShowOnStartup();
        }

RibbonControl 学习

可以用来实现类似excel的工具栏 说一下理解 RibbonStyle=“Office2019”
大概的层级结构 RibbonControl ->RibbonDefaultPageCategory->RibbonPage ->RibbonPageGroup ->BarButtonItem
BarButtonItem 集合按钮 Glyph 设置图片ICON
ShowApplicationButton 控制一个默认按钮

 <dxr:RibbonControl  Name="NavBar" DockPanel.Dock="Top" ShowApplicationButton="False" ApplicationButtonText="系统设置"  RibbonStyle="Office2019"    RowIndent="0">
            <dxr:RibbonDefaultPageCategory>
                <dxr:RibbonPage x:Name="ribbonPage_Setting" Caption="设置">
                    <dxr:RibbonPageGroup    >
                        <dxb:BarButtonItem Name="New" Content="创建" 
                   Glyph="{dx:DXImage Image=New_16x16.png}" 
                   LargeGlyph="{dx:DXImage Image=New_32x32.png}"   
                   Description="Creates a new document."
                   Hint="Creates a blank document."
                   RibbonStyle="All" Alignment="Default" />
                        <dxb:BarButtonItem Name="bOpen" Content="打开" 
                   Glyph="{dx:DXImage Image=OPen_16x16.png}" 
                   LargeGlyph="{dx:DXImage Image=OPen_32x32.png}"   
                   Description="Opens a file."
                   Hint="Opens a file."
                   RibbonStyle="SmallWithText"/>

                    <dxb:BarButtonItem Name="bClose" Content="关闭" 
                    Glyph="{dx:DXImage Image=Close_16x16.png}" 
                   LargeGlyph="{dx:DXImage Image=Close_32x32.png}" 
                   Hint="Closes the current document"
                   RibbonStyle="SmallWithText"/>

                        <dxb:BarButtonItem Name="bPrint" Content="打印" 
                  Glyph="{dx:DXImage Image=Print_16x16.png}" 
                   LargeGlyph="{dx:DXImage Image=Print_32x32.png}" 
                   Description="Prints the document."
                   Hint="Prints the document." 
                   RibbonStyle="SmallWithText"/>
                        <dxb:BarItemLinkSeparator/>
                        
                        <dxb:BarSplitButtonItem Name="sbSave" Content="保存" 
                       ItemClick="Save"
                       Glyph="{dx:DXImage Image=Save_16x16.png}" 
                   LargeGlyph="{dx:DXImage Image=Save_32x32.png}" 
                        RibbonStyle="Large" ActAsDropDown="False">

                            <dxb:BarSplitButtonItem.PopupControl >
                                <dxb:PopupMenu>
                                    <dxb:BarButtonItem Name="bSave" Content="本地" 
                         
                            Description="Saves the document."
                            Hint="Saves the document."/>
                                    <dxb:BarButtonItem Name="bSaveAs" Content="保存至" 
                          
                            Description="Save Document As..."
                            Hint="Save Document As..."/>
                                </dxb:PopupMenu>
                            </dxb:BarSplitButtonItem.PopupControl>
                        </dxb:BarSplitButtonItem>
                    </dxr:RibbonPageGroup>
                </dxr:RibbonPage>
                <dxr:RibbonPage x:Name="ribbonPage_Main" Caption="主题">
                    <dxr:RibbonPageGroup   x:Name="ribbonPageGroup_Main" OverridesDefaultStyle="False">
                        <dxr:RibbonGalleryBarItem    x:Name="ribbonGalleryBarItem_Theme" RibbonStyle="SmallWithText">
                            <dxmvvm:Interaction.Behaviors >
                                <dxr:RibbonGalleryItemThemeSelectorBehavior   ShowTouchThemes="True" UseSvgGlyphs="True"  />
                            </dxmvvm:Interaction.Behaviors>
                        </dxr:RibbonGalleryBarItem>
                       
                    </dxr:RibbonPageGroup>
                
                </dxr:RibbonPage>
              
            </dxr:RibbonDefaultPageCategory>
        </dxr:RibbonControl>

布局学习

   //Grid  
  <Grid  Margin="3,3,10,3">
  // 设置Row
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
 //设置 Col
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
            <ColumnDefinition Width="*"></ColumnDefinition>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
        </Grid.ColumnDefinitions>
  //配置 Grid.Row 第几行 Grid.Column 第几列 是根据上面的配置来的
        <Label Grid.Row="0" Grid.Column="0" Margin="3" VerticalAlignment="Center">短视频链接:</Label>
        <TextBox  Grid.Row="0" Grid.Column="1" Margin="3" Height="Auto" VerticalAlignment="Center"    />
        <Button   Grid.Row="0" Grid.Column="2" Margin="3" Padding="2" Content="提交"   VerticalAlignment="Top"/>
         //配置 Grid.ColumnSpan 合并列
        <TextBlock  Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Margin="3" TextWrapping="Wrap" >
            
        </TextBlock>
    </Grid>

心得体会 一直是做web的 少许的接触wpf web这些 现在学习和通过看官网 发现他还是很强大的 内置的一些东西很多是web 端无法实现的 ,再次警示自己学习技术 不要对存在鄙夷心理 对的地方用对的方法。下一步学习MVVM 模式 现在写这个wpf 更多的还是接近于事件驱动。

你可能感兴趣的:(WPF,wpf,学习)