MahApps / MahApps.Metro

A framework that allows developers to cobble together a better UI for their own WPF applications with minimal effort.
https://mahapps.com
MIT License
9.26k stars 2.45k forks source link

The window commands style went wrong!! #670

Closed zhouzhipeng closed 10 years ago

zhouzhipeng commented 10 years ago

i'm sorry that upload the screen shoots failed! The MetroWindow commands foreground should be White and it was,but now it becomes to Black(minimize button,maxmize button ,close button and the separator line between them).I don't know how resolve it! Below is the vs2010 output log(may be helps):

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='MahApps.Metro.Controls.MetroWindow', AncestorLevel='1''. BindingExpression:Path=ShowTitleBar; DataItem=null; target element is 'WindowCommands' (Name=''); target property is 'NoTarget' (type 'Object') System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='MahApps.Metro.Controls.MetroWindow', AncestorLevel='1''. BindingExpression:Path=ShowTitleBar; DataItem=null; target element is 'Button' (Name=''); target property is 'NoTarget' (type 'Object') System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='MahApps.Metro.Controls.MetroWindow', AncestorLevel='1''. BindingExpression:Path=ShowTitleBar; DataItem=null; target element is 'Button' (Name=''); target property is 'NoTarget' (type 'Object')

zhouzhipeng commented 10 years ago

oh,no one knows? maybe nobody care this...

AzureKitsune commented 10 years ago

@zhouzhipeng Sorry about that, I was busy all week. We really need a screenshot to know what you're talking about. Take a screenshot and drag the screenshot onto this page while you're replying. It will automatically embed the picture here.

zhouzhipeng commented 10 years ago

@Amrykid 2013-09-23_154024 yeah,as you see,the screenshot is the right-top corner of the MetroWindow,and i used the blue theme. The minimize,maxmize and close button should be white color and they were.The log above shows that maybe the Datacontext issues,but i don't know how to fix it!

punker76 commented 10 years ago

@zhouzhipeng which version of mahapps?

zhouzhipeng commented 10 years ago

i'm not pretty sure,see the attachment for details.

------------------ 原始邮件 ------------------ 发件人: "Jan Karger";notifications@github.com; 发送时间: 2013年9月23日(星期一) 下午3:52 收件人: "MahApps/MahApps.Metro"MahApps.Metro@noreply.github.com; 抄送: "周志鹏"823143047@qq.com; 主题: Re: [MahApps.Metro] The window commands style went wrong!! (#670)

@zhouzhipeng which version of mahapps?

— Reply to this email directly or view it on GitHub.

punker76 commented 10 years ago

@zhouzhipeng sorry, i don't see any attachement.

zhouzhipeng commented 10 years ago

2013-09-23_155523

zhouzhipeng commented 10 years ago

@Amrykid i put it agin in the comment,see now?

punker76 commented 10 years ago

@zhouzhipeng try the latest MahApps.Metro 0.11.1.11-ALPHA 2013-09-23_10h16_09

zhouzhipeng commented 10 years ago

@punker76 I'm sorry to say that there is nothing changed even though getting with the latest version. It's strange that only my main window is affected and others are normal. I try to check all the resources in xaml, found nothing unusual.

punker76 commented 10 years ago

@zhouzhipeng so, show us some xaml code.

zhouzhipeng commented 10 years ago

@punker76 sorry for reply late! (hateful time lag). I copied some resource code below:

<Controls:MetroWindow x:Class="AccountBox.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:my="clr-namespace:AccountBox.UserControls"
        xmlns:Beans="clr-namespace:AccountBox.Logic.Beans"
        xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
        xmlns:GalaSoft_MvvmLight_Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"
        Title="AccountBox" Height="600" MinWidth="600" MinHeight="400" Width="926" WindowStartupLocation="CenterScreen" FontSize="16" Icon="/AccountBox;component/Images/meinv48.jpg" FontFamily="Microsoft YaHei" Closing="MetroWindow_Closing" WindowStyle="SingleBorderWindow">

    <Window.Resources>

        <ResourceDictionary>

            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
                <ResourceDictionary Source="/Resources/Icons.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/FlatButton.xaml" />

                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" />
                <ResourceDictionary Source="/Resources/TreeView.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>

    </Window.Resources>

    <Controls:MetroWindow.WindowCommands>
        <Controls:WindowCommands VerticalAlignment="Bottom">
            <Button ToolTip="皮肤设置" VerticalAlignment="Center" Margin="0,2,0,0">
                <Image Source="Images\system\skin_32X32.png" Width="17" Height="25"/>
            </Button>
            <Button ToolTip="帮助" VerticalAlignment="Center">
                <Image Source="Images\system\help.png" Width="14" Height="22"/>
            </Button>
        </Controls:WindowCommands>
    </Controls:MetroWindow.WindowCommands>
<Grid>. .omit...</Grid>
</Controls:MetroWindow>
punker76 commented 10 years ago

@zhouzhipeng what happens in your <ResourceDictionary Source="/Resources/TreeView.xaml" />

zhouzhipeng commented 10 years ago

Yeah it 's just a TreeView style.I'm sure there is nothing to do with the "TreeView.xaml" ,because i comment it out the issue still exists.

AzureKitsune commented 10 years ago

What about WindowStyle="SingleBorderWindow"? Try removing that from your window.

punker76 commented 10 years ago

@zhouzhipeng hi, please update to the latest nuget alpha package, put all the main resources to the app.xaml (like the main demo it does) and test it again. thx

zhouzhipeng commented 10 years ago

ok,I'll try

------------------ 原始邮件 ------------------ 发件人: "Jan Karger"; 发送时间: 2013年10月30日(星期三) 凌晨4:01 收件人: "MahApps/MahApps.Metro"; 抄送: "周志鹏"823143047@qq.com; 主题: Re: [MahApps.Metro] The window commands style went wrong!! (#670)

@zhouzhipeng hi, please update to the latest nuget alpha package, put all the main resources to the app.xaml (like the main demo it does) and test it again. thx

— Reply to this email directly or view it on GitHub.

zhouzhipeng commented 10 years ago

@punker76 hi,I tried the latest version just now,Lauching for the first time, the VS said "can't not resolve the Colours.xaml resource dictionary" (The meaning is almost) ,so i comment it out and it boots successful.Firstly i want to say,the issue #670 is resolved!But it brings some new problems. 1. 2013-11-01_095747 as you see ,the WindowCommands buttons (png files) now looks strange.And the interaction with the "-- 口 x" is poor ,i can hardly click them or make sure that i have got the mouse focus on them.

2.The drag-drop effect disappeared! 2013-11-01_100902 (version 0.10.1.1)

2013-11-01_101528 (latest version)

I have some drag-drop efffect made with the v0.10.1.1,and it run well before,but today i switch the version to your lasted one, there has none effect at all,and the drag-drop related functions also have not been triggered yet.

3.The Textbox style went wrong. 2013-11-01_102421

(mouse over but not focus in)

2013-11-01_102439 (mouse over and focus in)

The Textbox should look like this (it did in v0.10.1.1): 1.mouse over or focus in: black border. 2.mouse leave or blur : gray border.

AzureKitsune commented 10 years ago

@zhouzhipeng Change 'Colours.xaml' to 'Colors.xaml'. It was renamed.

zhouzhipeng commented 10 years ago

Eh,i just hardly forgot this. I changed 'Colours.xaml' to 'Colors.xaml' and the question No.3(I mentioned in last comment) is normal right.But the other two are still exist.

punker76 commented 10 years ago

@zhouzhipeng the default TextBoxstyle use following colors. you can change this in your own app.

        <Setter Property="BorderBrush"
                Value="{DynamicResource TextBoxBorderBrush}" />
        <Setter Property="Controls:TextboxHelper.FocusBorderBrush"
                Value="{DynamicResource TextBoxFocusBorderBrush}" />
        <Setter Property="Controls:TextboxHelper.MouseOverBorderBrush"
                Value="{DynamicResource TextBoxMouseOverBorderBrush}" />
zhouzhipeng commented 10 years ago

yeah,thank you,i have resolved the problem already.

------------------ 原始邮件 ------------------ 发件人: "Jan Karger"; 发送时间: 2013年11月6日(星期三) 下午5:07 收件人: "MahApps/MahApps.Metro"; 抄送: "周志鹏"823143047@qq.com; 主题: Re: [MahApps.Metro] The window commands style went wrong!! (#670)

@zhouzhipeng the default TextBoxstyle use following colors. you can change this in your own app.

— Reply to this email directly or view it on GitHub.

zhouzhipeng commented 10 years ago

@punker76 Oops,i meant the textbox problem being resolved but not the others.As you have closed it , maybe i should create another issue to describe them.

punker76 commented 10 years ago

@zhouzhipeng ok