请问ChildWindow如何设置可随IE的大小拖动而变化以及ChildWindow里DataForm的如何添加样式
- 1、页面跳一个ChildWindow,比较大,IE全屏时占显示4/3,所以当缩小IE大小的时候,有的东西就看不到,
请问如何设置ChildWindow大小随IE的大小而变化?
2、ChildWindow里的DataForm,DataGrid加载自定义样式失败
普通Window的时候通过ThemeVtil可加载自定义样式文件
所以不明白哪里不对
请问ChildWindow里如何加载DataForm,DataGrid控件自定义样式文件?
以上麻烦了
頑張って!
答案
你好,
1.public MainPage()
{
InitializeComponent();
this.SizeChanged += new SizeChangedEventHandler(MainPage_SizeChanged);
this.Loaded += new RoutedEventHandler(MainPage_Loaded);
}
void MainPage_SizeChanged(object sender, SizeChangedEventArgs e)
{
double scalex=e.NewSize.Width / (this.LayoutRoot.Width);
double scaley=e.NewSize.Height / (this.LayoutRoot.Height);
LayoutScale.ScaleX = e.NewSize.Width / (
this.LayoutRoot.Width);
LayoutScale.ScaleY = e.NewSize.Height / (
this.LayoutRoot.Height);
TransformGroup tfg= new TransformGroup();
tfg.Children.Add(
new ScaleTransform() { ScaleX = scalex, ScaleY = scaley });
this.cw.RenderTransform = tfg;
}
ChildWindow1 cw = new ChildWindow1();
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
cw.Show();
}
2. 能提供一个重现问题的项目文件吗? 可以上传到http://skydrive.live.com/ 然后贴一下连接.
Please remember to mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework http://cfx.codeplex.com/! If you have any feedback, please tell us.- 已标记为答案JasmineLily 2009年11月5日 6:46
- 已建议为答案Allen Chen - MSFTMSFT, Moderator2009年11月3日 3:39
全部回复
你好,
1.public MainPage()
{
InitializeComponent();
this.SizeChanged += new SizeChangedEventHandler(MainPage_SizeChanged);
this.Loaded += new RoutedEventHandler(MainPage_Loaded);
}
void MainPage_SizeChanged(object sender, SizeChangedEventArgs e)
{
double scalex=e.NewSize.Width / (this.LayoutRoot.Width);
double scaley=e.NewSize.Height / (this.LayoutRoot.Height);
LayoutScale.ScaleX = e.NewSize.Width / (
this.LayoutRoot.Width);
LayoutScale.ScaleY = e.NewSize.Height / (
this.LayoutRoot.Height);
TransformGroup tfg= new TransformGroup();
tfg.Children.Add(
new ScaleTransform() { ScaleX = scalex, ScaleY = scaley });
this.cw.RenderTransform = tfg;
}
ChildWindow1 cw = new ChildWindow1();
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
cw.Show();
}
2. 能提供一个重现问题的项目文件吗? 可以上传到http://skydrive.live.com/ 然后贴一下连接.
Please remember to mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework http://cfx.codeplex.com/! If you have any feedback, please tell us.- 已标记为答案JasmineLily 2009年11月5日 6:46
- 已建议为答案Allen Chen - MSFTMSFT, Moderator2009年11月3日 3:39
非常感谢
不好意思,问题2是我是帮同事问,表述不到位
ThemeVtil只是我们自己写的一个类
公司文件拷不出来,我手打下大概
namespace ThemeVtil
{
public static void ApplyTheme(FrameworkElement element)
{
Uri uri=new Uric(@"自定义样式文件路径名",UriKind.Relative);
ImplicitStyleManager.SetResourceDictionaryUri(element,uri);
ImplicitStyleManager.SetApplyMode(element,ImplicitStyleMode.Auto);
ImplicitStyleManager.Apply(element);
}}
页面后台:
ThemeVtil.ApplyTheme(控件名);//自定义样式里的控件名
这样写后,这个页面就可以用自定义组件了
但是从这个页面跳出来的ChildWindow里的DataForm并没有加载样式
ChildWindow是有自定义样式的
想请问的就是如何在ChildWindow里的DataForm加载自定义样式
麻烦了,非常感谢- 你好,
为了方便测试,请提供一下重现问题的项目. 你可以新建一个项目并提供最少的能够重现问题的代码.
可以上传到http://skydrive.live.com/ 然后贴一下连接.
Please remember to mark the replies as answers if they help and unmark them if they provide no help. Welcome to the All-In-One Code Framework http://cfx.codeplex.com/! If you have any feedback, please tell us. - 好的
因为现在在赶功能进度,我大概下周三左右上传小项目
实在是麻烦了,非常感谢!
---------
已解决~

