C# 需要帮助刷新viewport2DVisual3D对象类中的可视子对象(边框)的笔刷吗
我用的是刨床控制,效果很好。唯一的问题是,我在其中添加的边界对象的笔刷没有改变。它旋转得很好,但画笔似乎冻结了。我尝试了很多事情,但没有人能做到 控制链接: 我在许多帮助网站上搜索了很多内容,包括stackoverflow。这就是我尝试过但没有成功的东西 重要提示:我是从代码隐藏开始工作的,而不是XAML。它在XAML中工作得很好C# 需要帮助刷新viewport2DVisual3D对象类中的可视子对象(边框)的笔刷吗,c#,.net,wpf,refresh,C#,.net,Wpf,Refresh,我用的是刨床控制,效果很好。唯一的问题是,我在其中添加的边界对象的笔刷没有改变。它旋转得很好,但画笔似乎冻结了。我尝试了很多事情,但没有人能做到 控制链接: 我在许多帮助网站上搜索了很多内容,包括stackoverflow。这就是我尝试过但没有成功的东西 重要提示:我是从代码隐藏开始工作的,而不是XAML。它在XAML中工作得很好 this.UpdateLayout(); this.InvalidateMeasure(); this.InvalidateVisual(); this.Invali
this.UpdateLayout();
this.InvalidateMeasure();
this.InvalidateVisual();
this.InvalidateArrange();
((UIElement)_originalChild).UpdateLayout();
var child = VisualTreeHelper.GetChild(viewport2DVisual3D, 0);
((UIElement)child).UpdateLayout();
((UIElement)child).InvalidateMeasure();
((UIElement)child).InvalidateVisual();
((UIElement)child).InvalidateArrange();
根据本守则
//交互式前端可视化3D
Viewport2DVisual3D frontModel=新Viewport2DVisual3D(){Geometry=simpleQuad,Visual=_logicalChild,Material=frontMaterial,Transform=xfGroup}
现在,在测试之后,我怀疑一旦将对象添加到Viewport2DVisual3D中,就会有一个子对象,颜色和笔刷不再刷新,但会一直刷新到/之前。请参阅上面的“Visual=\u logicalChild”
我没有错误消息,它旋转良好,但是如果我更改颜色,画笔和边框的颜色不会更新
这是我的工作标记
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TestPlaneratorInXAML"
xmlns:Planerator="clr-namespace:Planerator;assembly=Planerator" x:Class="TestPlaneratorInXAML.MainWindow"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Planerator:Planerator x:Name="aPlaneratorControl" Height="100" VerticalAlignment="Top" Width="100">
<Border BorderBrush="Black" BorderThickness="5" HorizontalAlignment="Center" Height="100" VerticalAlignment="Top" Width="100" CornerRadius="5" Background="Black"/>
</Planerator:Planerator>
<Button x:Name="ChangeBackground" Content="Change background" HorizontalAlignment="Left" VerticalAlignment="Top" Width="160" PreviewMouseDown="ChangeBackground_PreviewMouseDown"/>
</Grid>
</Window>
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
namespace TestPlaneratorInXAML
{
/// <summary>
/// Logique d'interaction pour MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void ChangeBackground_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
((Border)aPlaneratorControl.Child).Background = Brushes.Red;
}
}
}
使用System.Windows;
使用System.Windows.Controls;
使用System.Windows.Input;
使用System.Windows.Media;
命名空间TestPlaneratorInXAML
{
///
///Logique d'interaction pour main window.xaml
///
公共部分类主窗口:窗口
{
公共主窗口()
{
初始化组件();
}
私有void ChangeBackground_PreviewMouseDown(对象发送器,鼠标按钮ventargs e)
{
((Border)aPlaneratorControl.Child)。背景=画笔。红色;
}
}
}
什么“在XAML中运行良好”?请发布您的工作标记。当然,这是工作标记。好的,我已经尝试从代码隐藏中重现问题,所有内容似乎都找到了。目前,我不知道如何找出我的问题并在更简单的环境中重现它。为了不浪费人们的时间,我想暂停这个请求,直到我的部门进行进一步调查。我很惭愧地说,但是刷子被冻结了。我不知道为什么它被冻住了或者是被什么冻住了。我正在做一些研究。我没有在代码中明确地冻结它。我继续我的根本原因分析,似乎边界在刨床中被光栅化,这导致边界被修复。仍在关注这个问题。。。