powered by simpleCommunicator - 2.0.59     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / WPF, Silverlight [игнор отключен] [закрыт для гостей] / TextBox WPF
14 сообщений из 14, страница 1 из 1
TextBox WPF
    #36877802
GFX
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Господа, ни как не могу понять, где я накосячил.
Имеется вот такой XAML.
При вооде значения в TextBox. получаю вот такую ошибку:
Object reference not set to an instance of an object.
Ну почему? Направте пожалуйста.

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
<Window x:Class="WPF.App.Views.LoginView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Name="LoginViewWindow"
    Title="LoginView" 
    WindowStartupLocation="CenterScreen" 
    WindowState="Normal" 
    Width="733" Height="509"
    ShowInTaskbar="False"
    WindowStyle="None"
    Background="#FF3E67A3">
    
    <Window.Effect>
        <DropShadowEffect/>
    </Window.Effect>
    <Grid x:Name="LayoutRoot">
        <Button Command="{Binding ExitCommand}" Name="CloseButton" Content="Close" HorizontalAlignment="Right" Margin="0,18,8,0" VerticalAlignment="Top" Width="56" Height="52" >
            <Button.Effect>
                <DropShadowEffect/>
            </Button.Effect>
        </Button>
        <Label  Height="42" FontSize="24" HorizontalAlignment="Left" Margin="55,70,0,0" Name="label1" VerticalAlignment="Top" Width="120">Логин</Label>
        <Label FontSize="24" Height="42" HorizontalAlignment="Left" Margin="55,118,0,0" Name="label2" VerticalAlignment="Top" Width="120">Пароль</Label>
        <TextBox Text="{Binding UserLogin}" FontSize="24" Height="36" Margin="181,70,202,0" Name="textBox1" VerticalAlignment="Top">
            <TextBox.Effect>
                <DropShadowEffect/>
            </TextBox.Effect>
        </TextBox>
        <PasswordBox FontSize="24" Height="36" Margin="181,118,202,0" Name="passwordBox1" VerticalAlignment="Top" >
            <PasswordBox.Effect>
                <DropShadowEffect/>
            </PasswordBox.Effect>
        </PasswordBox>
    </Grid>
</Window>
...
Рейтинг: 0 / 0
TextBox WPF
    #36877873
AlexeiK
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
GFX,

код тоже нужно показать.
...
Рейтинг: 0 / 0
TextBox WPF
    #36878446
GFX
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
AlexeiK,

Кода, нет. Просто контролы накиданные на форму.



На рабочем компе ошибка есть. А на домашнем нет. Хотя и там и там VS2008 SP1
...
Рейтинг: 0 / 0
TextBox WPF
    #36878475
Dr_Wolf
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Text="{Binding UserLogin}" - нет объекта UserLogin
...
Рейтинг: 0 / 0
TextBox WPF
    #36879880
GFX
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Ладно пойдем другим путем.

Файл Window1.xaml
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
<Window x:Class="WpfApplication2.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
        <TextBox Height="23" Margin="17,33,28,0" Name="textBox1" VerticalAlignment="Top" />
    </Grid>
</Window>

Файл Window1.xaml.cs
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApplication2
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }
    }
}

и все равно та же ошибка...
...
Рейтинг: 0 / 0
TextBox WPF
    #36879908
AlexeiK
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
GFX,

application.xaml.vb и xaml покажи еще.
...
Рейтинг: 0 / 0
TextBox WPF
    #36879921
GFX
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Хорошо. Вот

App.xaml
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
<Application x:Class="WpfApplication2.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    StartupUri="Window1.xaml">
    <Application.Resources>
         
    </Application.Resources>
</Application>

App.xaml.cs
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;

namespace WpfApplication2
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
    }
}
Т.е. я просто создаю пустой проект. и кидаю textBox.
...
Рейтинг: 0 / 0
TextBox WPF
    #36879935
GFX
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Из все этого

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
<Window x:Class="WpfApplication2.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
        <TextBox Height="23" Margin="17,33,28,0" Name="textBox1" VerticalAlignment="Top" AcceptsReturn="True" AcceptsTab="True" AutoWordSelection="True" ForceCursor="True"/>
        <ComboBox Height="23" Margin="17,62,0,0" Name="comboBox1" VerticalAlignment="Top" IsEditable="True" HorizontalAlignment="Left" Width="120" />
        <PasswordBox Margin="17,91,0,0" Name="passwordBox1" Height="23" HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" />
        <RichTextBox Height="100" Margin="17,120,61,42" Name="richTextBox1" Width="200" />
    </Grid>
</Window>

Я могу вводить значения только в PasswordBox :(
...
Рейтинг: 0 / 0
TextBox WPF
    #36879940
AlexeiK
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
GFX,

и еще содержимое cproj файлик. ну типа там свойства проекта.
...
Рейтинг: 0 / 0
TextBox WPF
    #36879947
GFX
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
AlexeiK,

Пожалуйста.

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion> 9 . 0 . 30729 </ProductVersion>
    <SchemaVersion> 2 . 0 </SchemaVersion>
    <ProjectGuid>{FA7C10D0-FAD6-4E73-91CC-585ABC8DC7AB}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>WpfApplication2</RootNamespace>
    <AssemblyName>WpfApplication2</AssemblyName>
    <TargetFrameworkVersion>v3. 5 </TargetFrameworkVersion>
    <FileAlignment> 512 </FileAlignment>
    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <WarningLevel> 4 </WarningLevel>
    <StartupObject>WpfApplication2.App</StartupObject>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel> 4 </WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel> 4 </WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core">
      <RequiredTargetFramework> 3 . 5 </RequiredTargetFramework>
    </Reference>
    <Reference Include="System.Xml.Linq">
      <RequiredTargetFramework> 3 . 5 </RequiredTargetFramework>
    </Reference>
    <Reference Include="System.Data.DataSetExtensions">
      <RequiredTargetFramework> 3 . 5 </RequiredTargetFramework>
    </Reference>
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
    <Reference Include="WindowsBase" />
    <Reference Include="PresentationCore" />
    <Reference Include="PresentationFramework" />
  </ItemGroup>
  <ItemGroup>
    <ApplicationDefinition Include="App.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </ApplicationDefinition>
    <Page Include="Window1.xaml">
      <Generator>MSBuild:Compile</Generator>
      <SubType>Designer</SubType>
    </Page>
    <Compile Include="App.xaml.cs">
      <DependentUpon>App.xaml</DependentUpon>
      <SubType>Code</SubType>
    </Compile>
    <Compile Include="Window1.xaml.cs">
      <DependentUpon>Window1.xaml</DependentUpon>
      <SubType>Code</SubType>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Properties\AssemblyInfo.cs">
      <SubType>Code</SubType>
    </Compile>
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="Properties\Settings.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <None Include="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
    <AppDesigner Include="Properties\" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
...
Рейтинг: 0 / 0
TextBox WPF
    #36879958
AlexeiK
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
GFX,

а поймай ошибку через try catch и покажи стек вызова.
...
Рейтинг: 0 / 0
TextBox WPF
    #36879975
GFX
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
AlexeiK,
...
Рейтинг: 0 / 0
TextBox WPF
    #36879981
GFX
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Полное свойство StackTrace

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
at System.Windows.Documents.TextStore.OnGotFocus()
   at System.Windows.Documents.TextEditor.OnGotKeyboardFocus(Object sender, KeyboardFocusChangedEventArgs e)
   at System.Windows.Controls.Primitives.TextBoxBase.OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
   at System.Windows.UIElement.OnGotKeyboardFocusThunk(Object sender, KeyboardFocusChangedEventArgs e)
   at System.Windows.Input.KeyboardFocusChangedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.KeyboardDevice.ChangeFocus(DependencyObject focus, Int32 timestamp)
   at System.Windows.Input.KeyboardDevice.TryChangeFocus(DependencyObject newFocus, IKeyboardInputProvider keyboardInputProvider, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
   at System.Windows.Input.KeyboardDevice.Focus(DependencyObject focus, Boolean askOld, Boolean askNew)
   at System.Windows.Input.KeyboardDevice.Focus(IInputElement element)
   at System.Windows.UIElement.Focus()
   at System.Windows.Documents.TextEditorMouse.MoveFocusToUiScope(TextEditor This)
   at System.Windows.Documents.TextEditorMouse.OnMouseDown(Object sender, MouseButtonEventArgs e)
   at System.Windows.Controls.Primitives.TextBoxBase.OnMouseDown(MouseButtonEventArgs e)
   at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
   at WpfApplication2.App.Main() in c:\My_Dox\Visual Studio  2008 \Projects\WpfApplication2\WpfApplication2\obj\Debug\App.g.cs:line  0 
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
...
Рейтинг: 0 / 0
TextBox WPF
    #36880224
GFX
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
AlexeiK, Спасибо Вам за поддержку.

Тема закрыта.
Решение проблемы я нашел здесь
http://www.windows-tech.info/11/15c1659d61689d77.php
...
Рейтинг: 0 / 0
14 сообщений из 14, страница 1 из 1
Форумы / WPF, Silverlight [игнор отключен] [закрыт для гостей] / TextBox WPF
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]