Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
A

ArtemCh

@ArtemCh
About
Posts
4
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Problem with attaching a copy of DB which is recieved from another server
    A ArtemCh

    Problem is solved by adding full access permisions for 'MSSQLUser' user group to the file_path directory.

    Database database question help sharepoint sql-server

  • Problem with attaching a copy of DB which is recieved from another server
    A ArtemCh

    Hi! I need to move a database from one server to another. So I have the server 'S1', the database 'DB1' which is located on the server 'S1' and the server 'S2'. I use MS SQL Server 2005 Express. I carried out following actions: 1) executed stored procedure sp_detach_db 'DB1' on server 'S1' 2) copied files DB1.mdf and DB1Log.ldf from 'S1' to 'S2' 3) tried to execute the query on the server 'S2':

    CREATE DATABASE DB1
    ON (NAME = DB1_data, FILENAME = 'file_path\DB1.mdf')
    LOG ON (NAME = DB1_log, FILENAME = 'file_path\DB1Log.ldf')
    FOR ATTACH

    and recieved the error: "Unable to open the physical file "file_path\DB1.mdf Operating system error 5". When I executed the same query on 'S1' to attach DB1 again it was finished successfully... Tell me please what is the source of the error? and how do I solve my problem.

    Database database question help sharepoint sql-server

  • How to get access to control in template from source code
    A ArtemCh

    Koleraba, thank you for reply. But i've already solved my problem. In first message i raised more comprehensive problem then it was. I've just needed to update ListBoxItem source when it loses focus, becouse binding which is defined in template is one way. To do this i simply wrote OnKeyBoardLostFocus handler for the TextBox. Template:

    <TextBox Name="PART_TextBox" BorderThickness="0"
    Text="{Binding Path=Content, Mode=OneWay,
    Converter={StaticResource RecordNameGetter},
    RelativeSource={RelativeSource TemplatedParent}}"
    LostKeyboardFocus="OnLTBLostKeybordFocus"/>

    Handler:

    private void OnLTBLostKeybordFocus(object sender, KeyboardFocusChangedEventArgs args)
    {
    TextBox tb_sender = (TextBox)sender;
    if (typeof(SomeClass1) == tb_sender.DataContext.GetType())
    {
    SomeClass1 ob1 = (SomeClass1)tb_sender.DataContext;
    ob1.Name = tb_sender.Text;
    }
    else if (typeof(SomeClass2) == tb_sender.DataContext.GetType())
    {
    SomeClass2 ob2 = (SomeClass2)tb_sender.DataContext;
    ob2.Name = tb_sender.Text;
    }
    }

    So initial problem was solved, but this solution is far from been good extensible. If i want use the template with another one SomeClass3 i should modify OnLTBLostKeybordFocus. And if i'll have access to the TextBox from code i can update ListBoxItem source in "any" place of the application. Solution proposed by you is fitted for control with content, but ListBox isn't such type of control. Therefore how does your solution work with ListBox is open for me question. And does solution for the problem outlined in my firs message exist is open question for me too...

    WCF and WF question database wpf wcf tutorial

  • How to get access to control in template from source code
    A ArtemCh

    Hi! I want to create editing ListBox. To do this I've defined control template for ListBoxItem:

        <Style x:Key="TextBoxListStyle" TargetType="{x:Type ListBox}">
            <Setter Property="ItemContainerStyle">
                <Setter.Value>
                    <Style TargetType="{x:Type ListBoxItem}">
                        <Setter Property="Margin" Value="2"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                    <TextBox Name="PART\_TextBox" BorderThickness="0" 
                                             Text="{Binding Path=Content, Mode=OneWay, Converter={StaticResource RecordNameGetter},
                                                    RelativeSource={RelativeSource TemplatedParent}}"/>
                                    <ControlTemplate.Triggers>
                                        <Trigger SourceName="PART\_TextBox" Property="IsFocused" Value="True">
                                            <Setter Property="IsSelected" Value="True"/>
                                            <Setter TargetName="PART\_TextBox" Property="BorderThickness" Value="1"/>
                                        </Trigger>
                                        <Trigger SourceName="PART\_TextBox" Property="IsFocused" Value="False">
                                            <Setter Property="IsSelected" Value="False"/>
                                            <Setter TargetName="PART\_TextBox" Property="BorderThickness" Value="0"/>
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </Setter.Value>
            </Setter>
        </Style>
    

    ...
    <ListBox Name="lstSomeList" Style="{StaticResource TextBoxListStyle}"
    SelectionChanged="OnSelectionChangeSomeList"/>

    Question is how can I get access to TextBox "PART_TextBox" defined in template from OnSelectionChangeSomeList method?

    WCF and WF question database wpf wcf tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups