标签: user-controls

在构建服务器而不是开发机器上编译时 DLL 的差异

我有一个将用户控件加载到 .NET Web 应用程序中的应用程序。当我在我的开发机器上本地编译和测试应用程序时,它可以在我的机器上运行。 该项目在我们的构建服务器上使用 MSBuild 成功构建。但是,当我在构建服务器上部署 MSBuild 生成的 dll 时,应用程序加载控件时出现以下错误:

BC30456:“CreateResourceBasedLiteralControl”不是“ASP.usercontrols_somecontrol_ascx”的成员。

我看了一下,比较了我的机器上生成的 dll,并将其(查看文件大小)与构建服务器创建的 dll 进行了比较,发现文件大小存在差异。考虑到本地构建的代码和构建服务器上的代码是相同的,这是令人困惑的。我手动比较每个文件。所以我的问题是: 是什么导致了这个错误?MSBuild 的代码编译与 Visual Studio 编译代码时发生的情况有何不同?

asp.net msbuild user-controls visual-studio-2008

0
推荐指数
1
解决办法
1436
查看次数

WPF 为 TabItem 创建 UserControl

我需要帮助用用户控件替换一些 xaml 代码。我在主窗口中有两个选项卡,我想将第二个选项卡(显示为 Header=WCF)放在用户控件中。这是我的代码:

<Window x:Class="TesterTool.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:gif="http://wpfanimatedgif.codeplex.com"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:helpers="clr-namespace:TesterTool"
    xmlns:da ="clr-namespace:TesterTool.DatabaseAccess"
    xmlns:converters="clr-namespace:TesterTool.Converters"
    xmlns:vm="clr-namespace:TesterTool"
    Title="TestingTool v1.00" Height="350" Width="725"
    Icon="Icon.ico">

<Window.Resources>
    <converters:BoolVisibilityConverter x:Key="BoolVisibilityConverter" />
    <converters:InvertedBoolVisibilityConverter x:Key="InvertedBoolVisibilityConverter"/>
</Window.Resources>

<TabControl>
    <TabItem Header="WPF" Margin="-2,0" Height="22" VerticalAlignment="Bottom">
        <Grid>
            <Grid.Background>
                <ImageBrush ImageSource="image.png"/>
            </Grid.Background>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Image gif:ImageBehavior.AnimatedSource="332.gif"

            Width="152"
            Height="39"
           Margin="10,69,194,37"
           Grid.Row="1"
           Visibility="{Binding IsLoading, Converter={StaticResource BoolVisibilityConverter}}"/>
            <TextBox x:Name="tb1"
             Text ="{Binding BoxSerialNumber}"
             Height="23" Margin="128,26,0,0"
             TextWrapping="Wrap"
             VerticalAlignment="Top"
             HorizontalAlignment="Left" Width="220"
             />
            <TextBox x:Name="tbn2"
             Visibility="{Binding IsViewLogSelected, Converter={StaticResource InvertedBoolVisibilityConverter}}"
             Height="23" Margin="128,73,8,0"
             TextWrapping="Wrap"
             Text="{Binding HardwareID}"
             VerticalAlignment="Top"
             RenderTransformOrigin="0.494,0.478"/> …
Run Code Online (Sandbox Code Playgroud)

c# wpf user-controls

0
推荐指数
1
解决办法
4465
查看次数

设置目标后如何重新启动轨道控制

我为我THREE.OrbitControls的鼠标单击事件设置了一个新目标,并且效果很好。但是在相机平移到新位置后,我失去了与鼠标的所有交互。我正在用工作代码更新这个问题。

我想当我将相机 z 和目标 z 设置为相同的值时,我破坏了控件。

损坏的代码在这里:http : //www.kreativperspektiv.com/pb2/chartlock.html

工作代码在这里:http : //www.kreativperspektiv.com/pb2/chartcorrect.html

panCam(500,200,4000,1000);

        var xTarget=0;
        var yTarget=0;
        var zTarget=0;
        var tweenDuration=0;

        function panCam(xTarget,yTarget,zTarget,tweenDuration){

          TWEEN.removeAll();

          var camNewPosition= { x : xTarget, y : yTarget, z : zTarget};
          var targetNewPos = {x : xTarget, y : yTarget, z : 0};

          var camTween = new TWEEN.Tween(camera.position).to(camNewPosition, tweenDuration).easing(TWEEN.Easing.Quadratic.InOut).start();
          var targetTween = new TWEEN.Tween(controls.target).to(targetNewPos, tweenDuration).easing(TWEEN.Easing.Quadratic.InOut).start();
    }
Run Code Online (Sandbox Code Playgroud)

javascript user-controls three.js

0
推荐指数
1
解决办法
939
查看次数

使 WPF 用户控件高度适合其内容

我有以下 WPF 用户控件。它包含一个网格作为根。网格由单行和 4 列组成。在第二列中,有一个标签由于添加了更多文本而改变了其高度。我发现网格高度也发生了变化,这是我想要的,但用户控件高度却不是。那么如何使用户控件的高度适合其内容高度(在本例中为网格高度)?

<UserControl x:Class="MyUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:conv="clr-namespace:myConverters"
             mc:Ignorable="d" 
             d:DesignHeight="40" d:DesignWidth="500">
    <UserControl.Resources>
        <ResourceDictionary>
            <!-- Converters -->
            <BooleanToVisibilityConverter x:Key="BoolToVisibility" />
            <conv:InvertBooleanToVisibilityConverter x:Key="InvertBoolToVisibility" />
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto"/>
            <ColumnDefinition Width="auto"/>
            <ColumnDefinition Width="auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <Image Grid.Column="0" 
               Width="24"
               Height="24"
               Margin="8"
               Visibility="{Binding Path=IsVisible, Converter={StaticResource InvertBoolToVisibility}}"
               Source="{Binding Path=Icon}"/>
        
        <Label Grid.Column="1"
               VerticalAlignment="Center"
               VerticalContentAlignment="Center"
               HorizontalContentAlignment="Stretch"
               HorizontalAlignment="Left"
               MaxWidth="700"
               Width="auto"
               Height="Auto"
               Margin="5"
               Foreground="{Binding Path=ForegroundColor}">
            <TextBlock Text="{Binding Path=Text}" 
                       HorizontalAlignment="Stretch" 
                       VerticalAlignment="Center" 
                       Height="auto" 
                       Width="auto" 
                       TextWrapping="Wrap"/>
        </Label>

        <Button Grid.Column="2"
                Width="80"
                Height="28"
                VerticalAlignment="Center" …
Run Code Online (Sandbox Code Playgroud)

c# wpf user-controls .net-4.5 visual-studio-2019

0
推荐指数
1
解决办法
592
查看次数

如何从代码后面刷新自定义wpf用户控件?

我有这个自定义的wpf用户控件:

ShowCustomer.xaml:

<UserControl x:Class="TestControlUpdate2343.Controls.ShowCustomer"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid>
        <TextBlock Text="{Binding Message}"/>
    </Grid>
</UserControl>
Run Code Online (Sandbox Code Playgroud)

ShowCustomer.xaml.cs:

using System.Windows.Controls;
using System;
using System.ComponentModel;

namespace TestControlUpdate2343.Controls
{
    public partial class ShowCustomer : UserControl, INotifyPropertyChanged
    {
        #region ViewModelProperty: Message
        private string _message;
        public string Message
        {
            get
            {
                return _message;
            }

            set
            {
                _message = value;
                OnPropertyChanged("Message");
            }
        }
        #endregion

        public ShowCustomer()
        {
            InitializeComponent();
            DataContext = this;

            Message = "showing test customer at: " + DateTime.Now.ToString();
        }

        #region INotifiedProperty Block
        public event PropertyChangedEventHandler PropertyChanged;

        protected void …
Run Code Online (Sandbox Code Playgroud)

c# wpf xaml user-controls code-behind

-1
推荐指数
1
解决办法
4万
查看次数

这可能有三角形的 PictureBox 而不是矩形的吗?

这是否可以PictureBox在 Windows 窗体中使用三角形控件而不是矩形控件?

.net c# user-controls picturebox winforms

-1
推荐指数
1
解决办法
619
查看次数

如何将 List&lt;string&gt; 绑定到 DependencyProperty

我正在尝试了解 DependencyProperty。为此,我想创建一个UserControl显示列表的新对象。

此列表的位置必须作为属性存在于父级中。为此,我只有MainWindow, MainWindowViewModel (这些是父级)和UserControl(子级)(目前正在使用隐藏代码)。

在我的主窗口中,我有

<Grid>
    <uc:RecentList MessageList="{Binding Messages}" />    
</Grid>
Run Code Online (Sandbox Code Playgroud)

而在后面的代码中

public MainWindow()
{
    InitializeComponent();
    this.DataContext = new MainWindowViewModel();
}
Run Code Online (Sandbox Code Playgroud)

和视图模型

public MainWindowViewModel()
{
    this.Messages = new ObservableCollection<string>();
    this.Messages.Add("Item 1");
    this.Messages.Add("Item 2");
    this.T = "hi";
}

public ObservableCollection<string> Messages { get; set; }
Run Code Online (Sandbox Code Playgroud)

UserControl我有

<Grid>
    <ListView ItemsSource="{Binding MessageList}"></ListView>
    <TextBlock Text="I'm such text to verify this control is showing" />
</Grid>
Run Code Online (Sandbox Code Playgroud)

而背后的代码是

public static readonly DependencyProperty MessageListProperty =
DependencyProperty.Register(
"MessageList", typeof(IEnumerable<string>), …
Run Code Online (Sandbox Code Playgroud)

wpf user-controls

-2
推荐指数
1
解决办法
1067
查看次数