Click here to Skip to main content
15,892,575 members
Home / Discussions / C#
   

C#

 
GeneralRe: Missing data on Windows App form C# Pin
Luc Pattyn12-Jun-17 23:42
sitebuilderLuc Pattyn12-Jun-17 23:42 
QuestionJson parser error when converting iphone images from bytes to base64 string in a MVC JsonResult Pin
jkirkerx6-Jun-17 10:22
professionaljkirkerx6-Jun-17 10:22 
AnswerRe: Json parser error when converting iphone images from bytes to base64 string in a MVC JsonResult [solved] Pin
jkirkerx6-Jun-17 12:49
professionaljkirkerx6-Jun-17 12:49 
SuggestionRe: Json parser error when converting iphone images from bytes to base64 string in a MVC JsonResult [solved] Pin
Richard Deeming7-Jun-17 0:57
mveRichard Deeming7-Jun-17 0:57 
GeneralRe: Json parser error when converting iphone images from bytes to base64 string in a MVC JsonResult [solved] Pin
jkirkerx7-Jun-17 6:33
professionaljkirkerx7-Jun-17 6:33 
QuestionCreate a chart in PowerPoint using C#. Pin
Member 126813284-Jun-17 22:30
Member 126813284-Jun-17 22:30 
AnswerRe: Create a chart in PowerPoint using C#. Pin
OriginalGriff4-Jun-17 22:43
mveOriginalGriff4-Jun-17 22:43 
Questioncustom controls not binding wpf Pin
Member 112967764-Jun-17 7:52
Member 112967764-Jun-17 7:52 
Hi everybody,

i have created a user control combined with textbox and label.
i created text and label register to modify the label and textbox.
when i tried to bind the text and label nothing is shown.


here's the xaml of the user control:
<UserControl x:Class="Gestione_WPF.LabelledTextBox"
             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:local="clr-namespace:Gestione_WPF"
             mc:Ignorable="d" 
             d:DesignHeight="50" d:DesignWidth="200">
    <Grid Background="White" FlowDirection="RightToLeft">
       <Label x:Name="lbl" Content="{Binding Label, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"  HorizontalAlignment="Left" Background="{StaticResource gradientBrushTabControlHeader}">
            <Label.Style>
                <Style TargetType="Label">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="Label">
                                <StackPanel Orientation="Horizontal">
                                    <Border Background="{StaticResource ResourceKey=gradientBrushSegmentedTabItem}" Width="200" BorderThickness="0,0,0,0">
                                        <StackPanel Orientation="Horizontal">
                                            <Viewbox StretchDirection="DownOnly" Stretch="Uniform">
                                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" RecognizesAccessKey="True" TextBlock.FontSize="14" TextBlock.Foreground="#FFFFFF" Margin="5">
                                                <ContentPresenter.Effect>
                                                    <DropShadowEffect BlurRadius="0.0"
                                                  Color="#032A6B"
                                                  Direction="90"
                                                  Opacity="1"
                                                  ShadowDepth="1" />
                                                </ContentPresenter.Effect>
                                            </ContentPresenter>
                                            </Viewbox>
                                        </StackPanel>
                                    </Border>
                                </StackPanel>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Label.Style>
        </Label>
        <TextBox x:Name="txt" Text="{Binding Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="120" HorizontalAlignment="Right">
            <TextBox.Style>
                <Style TargetType="TextBox">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="TextBox">
                                <Border CornerRadius="0,0,0,50" BorderBrush="Black" Background="White" BorderThickness="0">
                                    <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" RecognizesAccessKey="True" TextBlock.FontSize="14" TextBlock.Foreground="#FFFFFF" Margin="5">
                                        <ContentPresenter.Effect>
                                            <DropShadowEffect BlurRadius="0.0"
                                                  Color="#032A6B"
                                                  Direction="90"
                                                  Opacity="1"
                                                  ShadowDepth="1" />
                                        </ContentPresenter.Effect>
                                    </ContentPresenter>
                                </Border>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </TextBox.Style>
        </TextBox>
    </Grid>
</UserControl>


here's the usercontrol.cs:
C#
public partial class LabelledTextBox : UserControl
   {
       public LabelledTextBox()
       {
           InitializeComponent();
           this.DataContext = this;
       }

       public override void OnApplyTemplate()
       {
           base.OnApplyTemplate();
       }

       public static readonly DependencyProperty LabelProperty = DependencyProperty.Register("Label", typeof(string), typeof(LabelledTextBox), new PropertyMetadata(null));
       public string Label
       {
           get { return (string)this.GetValue(LabelProperty); }
           set { this.SetValue(LabelProperty, value);}
       }

       public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(LabelledTextBox), new PropertyMetadata(null));
       public string Text
       {
           get { return (string)this.GetValue(TextProperty); }
           set { this.SetValue(TextProperty, value); }
       }
   }


and here's the implmentation:
C#
<controls:LabelledTextBox Label="{Binding Hello}" Text="{Binding World}"/>



Why the binding not showing? if the label i'm doing without binding it works, but the text don't and i can't write inside the textbox.
AnswerRe: custom controls not binding wpf Pin
Gerry Schmitz5-Jun-17 5:36
mveGerry Schmitz5-Jun-17 5:36 
GeneralRe: custom controls not binding wpf Pin
Member 112967765-Jun-17 18:30
Member 112967765-Jun-17 18:30 
QuestionConfigure Remote Machine's IP in C# Service At Install Time Pin
Django_Untaken3-Jun-17 22:58
Django_Untaken3-Jun-17 22:58 
AnswerRe: Configure Remote Machine's IP in C# Service At Install Time Pin
Eddy Vluggen4-Jun-17 2:55
professionalEddy Vluggen4-Jun-17 2:55 
AnswerRe: Configure Remote Machine's IP in C# Service At Install Time Pin
Gerry Schmitz4-Jun-17 4:45
mveGerry Schmitz4-Jun-17 4:45 
QuestionReport cant be display on report viewer page in c#.net windows form Pin
Member 132383512-Jun-17 22:31
Member 132383512-Jun-17 22:31 
AnswerRe: Report cant be display on report viewer page in c#.net windows form Pin
User 41802543-Jun-17 3:32
User 41802543-Jun-17 3:32 
QuestionHow to solve 2 js script file crash problem Pin
Member 130563031-Jun-17 16:22
Member 130563031-Jun-17 16:22 
AnswerRe: How to solve 2 js script file crash problem PinPopular
Gerry Schmitz1-Jun-17 16:47
mveGerry Schmitz1-Jun-17 16:47 
GeneralRe: How to solve 2 js script file crash problem Pin
OriginalGriff1-Jun-17 20:25
mveOriginalGriff1-Jun-17 20:25 
AnswerRe: How to solve 2 js script file crash problem Pin
Pete O'Hanlon1-Jun-17 21:49
mvePete O'Hanlon1-Jun-17 21:49 
Questiondatagrid view to pdf by iTextsharp Pin
Member 130230281-Jun-17 9:07
Member 130230281-Jun-17 9:07 
AnswerRe: datagrid view to pdf by iTextsharp Pin
Afzaal Ahmad Zeeshan1-Jun-17 10:46
professionalAfzaal Ahmad Zeeshan1-Jun-17 10:46 
AnswerRe: datagrid view to pdf by iTextsharp Pin
Gerry Schmitz1-Jun-17 16:46
mveGerry Schmitz1-Jun-17 16:46 
QuestionHow can i effectively write the code for calling a function before and after execution of every function in a class. Pin
yeswanthkumar30-May-17 2:51
yeswanthkumar30-May-17 2:51 
AnswerRe: How can i effectively write the code for calling a function before and after execution of every function in a class. Pin
Pete O'Hanlon30-May-17 3:11
mvePete O'Hanlon30-May-17 3:11 
AnswerRe: How can i effectively write the code for calling a function before and after execution of every function in a class. Pin
Gerry Schmitz30-May-17 12:41
mveGerry Schmitz30-May-17 12:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.