Custom Control as Window

I want to use Custom Title bar in my app so I must put window style on none and corner radius and shadow of window will be disappear for that actually i have three ways first one is make radius for my title bar and status bar with transparent back ground second one a grid with radius and transparent background and the third one is make a custom control and use as window element which i think its best way but i get this error: error CS0263: Partial declarations of 'MainWindow' must not specify different base classes I checked inheritance and was ok so first of all how is that possible to use custom control as window and second question is Is any better way to have custom title bar and properties like shadow or CornerRadius Together
1 Reply
-♤ΛℭΞ RΛMIП
-♤ΛℭΞ RΛMIПOP10mo ago
new problem my first question was solved i forget to inheritance main window and there isn't any error but my window doesn't have corner radius
using System.Windows;

namespace Hexagon_V2
{
public class CustomWindow : Window
{

public int CornerRadius
{
get { return (int)GetValue(CornerRadiusProperty); }
set { SetValue(CornerRadiusProperty, value); }
}

public static readonly DependencyProperty CornerRadiusProperty =
DependencyProperty.Register("CornerRadius", typeof(int), typeof(CustomWindow), new PropertyMetadata(0));

static CustomWindow()
{

DefaultStyleKeyProperty.OverrideMetadata(typeof(CustomWindow), new FrameworkPropertyMetadata(typeof(CustomWindow)));
}
}
}
using System.Windows;

namespace Hexagon_V2
{
public class CustomWindow : Window
{

public int CornerRadius
{
get { return (int)GetValue(CornerRadiusProperty); }
set { SetValue(CornerRadiusProperty, value); }
}

public static readonly DependencyProperty CornerRadiusProperty =
DependencyProperty.Register("CornerRadius", typeof(int), typeof(CustomWindow), new PropertyMetadata(0));

static CustomWindow()
{

DefaultStyleKeyProperty.OverrideMetadata(typeof(CustomWindow), new FrameworkPropertyMetadata(typeof(CustomWindow)));
}
}
}
public partial class MainWindow : CustomWindow
{
public MainWindow()
{
InitializeComponent();
}
}
public partial class MainWindow : CustomWindow
{
public MainWindow()
{
InitializeComponent();
}
}

<local:CustomWindow x:Class="Hexagon_V2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="clr-namespace:Hexagon_V2"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="450" Width="800" WindowStyle="None"
AllowsTransparency="True" CornerRadius="30" Background="Aqua">


<Grid>

</Grid>

</local:CustomWindow>

<local:CustomWindow x:Class="Hexagon_V2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="clr-namespace:Hexagon_V2"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="450" Width="800" WindowStyle="None"
AllowsTransparency="True" CornerRadius="30" Background="Aqua">


<Grid>

</Grid>

</local:CustomWindow>
Want results from more Discord servers?
Add your server