Click here to Skip to main content
15,887,776 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Upload Images to SQL database in silverlight Pin
Arun Jacob2-Sep-09 20:03
Arun Jacob2-Sep-09 20:03 
QuestionUsercontrol properties Pin
krishnan.s1-Sep-09 18:53
krishnan.s1-Sep-09 18:53 
AnswerRe: Usercontrol properties Pin
Krishna Aditya1-Sep-09 22:43
Krishna Aditya1-Sep-09 22:43 
AnswerRe: Usercontrol properties Pin
Pete O'Hanlon1-Sep-09 23:06
mvePete O'Hanlon1-Sep-09 23:06 
GeneralRe: Usercontrol properties Pin
krishnan.s2-Sep-09 1:35
krishnan.s2-Sep-09 1:35 
GeneralRe: Usercontrol properties Pin
Pete O'Hanlon4-Sep-09 10:09
mvePete O'Hanlon4-Sep-09 10:09 
GeneralRe: Usercontrol properties [modified] Pin
PaulPrice3-Sep-09 4:02
PaulPrice3-Sep-09 4:02 
GeneralRe: Usercontrol properties Pin
Pete O'Hanlon4-Sep-09 10:08
mvePete O'Hanlon4-Sep-09 10:08 
Here's a sample that shows how to do this (first of all, the XAML):
<UserControl
	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"
	mc:Ignorable="d"
	x:Class="WpfSample.CurrentStatusView"
	x:Name="UserControl"
	d:DesignWidth="640" d:DesignHeight="480">

	<Grid x:Name="LayoutRoot">
		<Button HorizontalAlignment="Left" VerticalAlignment="Top" Content="{Binding ButtonText}"/>
	</Grid>
</UserControl>
then the code behind
using System;
using System.Collections.Generic;
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;
using System.ComponentModel;

namespace WpfSample
{
  /// <summary>
  /// Interaction logic for CurrentStatusView.xaml
  /// </summary>
  public partial class CurrentStatusView : UserControl
  {
    public CurrentStatusView()
    {
      this.InitializeComponent();
      ButtonText = "Hello there";
      DataContext = this;
    }

    public static DependencyProperty ButtonTextProperty = 
      DependencyProperty.Register(
        "ButtonText", 
        typeof(string), 
        typeof(CurrentStatusView));
    public string ButtonText
    {
      get { return GetValue(ButtonTextProperty).ToString(); }
      set { SetValue(ButtonTextProperty, value); }
    }
  }
}
Finally, you set it with:
<WpfSample:CurrentStatusView ButtonText="Howdy" HorizontalAlignment="Left" Margin="27,42,0,0" VerticalAlignment="Top" />


"WPF has many lovers. It's a veritable porn star!" - Josh Smith

As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.


My blog | My articles | MoXAML PowerToys | Onyx



Question[Message Deleted] Pin
ProgrammerWPF1-Sep-09 16:02
ProgrammerWPF1-Sep-09 16:02 
AnswerRe: Creating a customcontrol Pin
Super Lloyd1-Sep-09 16:56
Super Lloyd1-Sep-09 16:56 
QuestionBring up Window from Hyperlink Pin
fjparisIII1-Sep-09 13:49
fjparisIII1-Sep-09 13:49 
AnswerRe: Bring up Window from Hyperlink (I SOLVED IT -- need to bring up a Page, not a Window) Pin
fjparisIII2-Sep-09 10:15
fjparisIII2-Sep-09 10:15 
QuestionHow to copy a TList? Pin
CBenac1-Sep-09 3:22
CBenac1-Sep-09 3:22 
QuestionRe: How to copy a TList? Pin
Mark Salsbery1-Sep-09 5:43
Mark Salsbery1-Sep-09 5:43 
AnswerRe: How to copy a TList? Pin
CBenac1-Sep-09 6:54
CBenac1-Sep-09 6:54 
GeneralRe: How to copy a TList? Pin
Mark Salsbery1-Sep-09 7:23
Mark Salsbery1-Sep-09 7:23 
GeneralRe: How to copy a TList? [modified] Pin
CBenac1-Sep-09 12:19
CBenac1-Sep-09 12:19 
GeneralRe: How to copy a TList? Pin
Pete O'Hanlon1-Sep-09 22:02
mvePete O'Hanlon1-Sep-09 22:02 
AnswerRe: How to copy a TList? Pin
Edbert P1-Sep-09 16:46
Edbert P1-Sep-09 16:46 
GeneralRe: How to copy a TList? Pin
CBenac2-Sep-09 3:04
CBenac2-Sep-09 3:04 
GeneralRe: How to copy a TList? Pin
Edbert P3-Sep-09 16:20
Edbert P3-Sep-09 16:20 
QuestionHow to capture Child Name and the Parent Name in a tree view in WPF + MVP Pin
Krishna Aditya1-Sep-09 2:09
Krishna Aditya1-Sep-09 2:09 
AnswerRe: How to capture Child Name and the Parent Name in a tree view in WPF + MVP Pin
Richard MacCutchan1-Sep-09 12:15
mveRichard MacCutchan1-Sep-09 12:15 
QuestionUpdate silverlight xap file Pin
Nekkantidivya31-Aug-09 19:18
Nekkantidivya31-Aug-09 19:18 
AnswerRe: Update silverlight xap file Pin
zlezj1-Sep-09 0:49
zlezj1-Sep-09 0:49 

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.