1、ResizeMode不好使
2、 int GWL_STYLE = -16;
       int WS_MAXIMIZEBOX = 0x00010000;
       int SWP_NOSIZE = 0x0001;
       int SWP_NOMOVE = 0x0002;
       int SWP_FRAMECHANGED = 0x0020;       IntPtr handle = new WindowInteropHelper(this).Handle;
       int nStyle = GetWindowLong(handle, GWL_STYLE);
       nStyle &= ~(WS_MAXIMIZEBOX);
 
       SetWindowLong(handle, GWL_STYLE, nStyle);                        SetWindowPos(handle, IntPtr.Zero, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_FRAMECHANGED);
也不好使
3、改Fluent库,也没改明白
求大神wpf

解决方案 »

  1.   

    解决了 找到RibbonWindow.cs 删除里面内容:// Handles Maximize command
            static void OnMaximizeCommandExecuted(object sender, ExecutedRoutedEventArgs e)
            {
               
            }        // Handles Normalize command
            static void OnNormalizeCommandExecuted(object sender, ExecutedRoutedEventArgs e)
            {
              
            }  
    在主窗口设置ResizeMode 搞定
      

  2.   

    为什么我就不行,这样设置最大化按钮还在,只是点击没反应吧
    那就行了啊,你改下那个按钮的样式,把它变灰或者透明度调低,比就和正常窗口最大化按钮禁用一样了!

    不让它变大的功能我早就弄好了,但是怎样让那个按钮变灰啊。如何设置按钮样式啊,求教
    不跟你说了吗,就把它透明度调低,比如我用的是Blue.xaml 样式,实际上按钮就是贴的图片,只要把图片透明度调整就行了:
     <Button x:Name="maximizeButton" Margin="-1,0,0,0"  Style="{StaticResource CaptionButtonStyle}" Width="35" Height="19" BorderThickness="0,0,0,1" Command="{x:Static Fluent:RibbonWindow.MaximizeCommand}">
                     <Image Width="Auto" Height="Auto" Opacity="0.3"   HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="None" Source="{StaticResource ImageCaptionButtonMaximize}" SnapsToDevicePixels="True" />
                  </Button>