Repeatable pattern in WPF











up vote
0
down vote

favorite












I'm trying to achieve quite a specific thing in WPF. I need to create a verifiable control, which will be binded to object of generic class like this



public interface IVerifiable
{
bool Verified { get; set; }
}

public class VerifiableProperty<T> : INotifyPropertyChanged, IVerifiable
{
private T _value;
private bool _verified;

public T Value
{
get => _value;
set
{
if (Equals(value, _value)) return;
_value = value;
OnPropertyChanged();
}
}

public bool Verified
{
get => _verified;
set
{
if (value == _verified) return;
_verified = value;
OnPropertyChanged();
}
}
}


I bind controls this way



<TextBox Text="{Binding Path=Number.Value}" att:VerifiableControl.Verified="{Binding Path=Number.Verified}"
BorderBrush="{Binding Path=(att:VerifiableControl.Verified), Mode=OneWay,
Converter={StaticResource BackColorVerifiedConverter}}">
<inter:Interaction.Triggers>
<inter:EventTrigger EventName="LostFocus">
<inter:InvokeCommandAction Command="{Binding Path=DataContext.VerifyCurrentFieldCommand, ElementName=Root}"
CommandParameter="{Binding Path=Number}"/>
</inter:EventTrigger>
</inter:Interaction.Triggers>
</TextBox>


Generic value of Verifiable property object binds to text (or SelectedDate in case of DatePicker, etc.), border color binds to flag "Verified" via converter and also I bind interaction trigger for "FocusLost" event to ViewModel command that just set "Verified" flag of corresponding property object to true.



I really don't like the idea I have to copypaste this block many times with little changes. I know, I cannot put intercation trigger in style and I also couldn't find another way to make some kind of short pattern for that.
So, is there a way to create some kind of short pattern for this xaml code where I could customize name of property to bind? Or maybe you could suggest another approach for what I want ot achieve?










share|improve this question


























    up vote
    0
    down vote

    favorite












    I'm trying to achieve quite a specific thing in WPF. I need to create a verifiable control, which will be binded to object of generic class like this



    public interface IVerifiable
    {
    bool Verified { get; set; }
    }

    public class VerifiableProperty<T> : INotifyPropertyChanged, IVerifiable
    {
    private T _value;
    private bool _verified;

    public T Value
    {
    get => _value;
    set
    {
    if (Equals(value, _value)) return;
    _value = value;
    OnPropertyChanged();
    }
    }

    public bool Verified
    {
    get => _verified;
    set
    {
    if (value == _verified) return;
    _verified = value;
    OnPropertyChanged();
    }
    }
    }


    I bind controls this way



    <TextBox Text="{Binding Path=Number.Value}" att:VerifiableControl.Verified="{Binding Path=Number.Verified}"
    BorderBrush="{Binding Path=(att:VerifiableControl.Verified), Mode=OneWay,
    Converter={StaticResource BackColorVerifiedConverter}}">
    <inter:Interaction.Triggers>
    <inter:EventTrigger EventName="LostFocus">
    <inter:InvokeCommandAction Command="{Binding Path=DataContext.VerifyCurrentFieldCommand, ElementName=Root}"
    CommandParameter="{Binding Path=Number}"/>
    </inter:EventTrigger>
    </inter:Interaction.Triggers>
    </TextBox>


    Generic value of Verifiable property object binds to text (or SelectedDate in case of DatePicker, etc.), border color binds to flag "Verified" via converter and also I bind interaction trigger for "FocusLost" event to ViewModel command that just set "Verified" flag of corresponding property object to true.



    I really don't like the idea I have to copypaste this block many times with little changes. I know, I cannot put intercation trigger in style and I also couldn't find another way to make some kind of short pattern for that.
    So, is there a way to create some kind of short pattern for this xaml code where I could customize name of property to bind? Or maybe you could suggest another approach for what I want ot achieve?










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'm trying to achieve quite a specific thing in WPF. I need to create a verifiable control, which will be binded to object of generic class like this



      public interface IVerifiable
      {
      bool Verified { get; set; }
      }

      public class VerifiableProperty<T> : INotifyPropertyChanged, IVerifiable
      {
      private T _value;
      private bool _verified;

      public T Value
      {
      get => _value;
      set
      {
      if (Equals(value, _value)) return;
      _value = value;
      OnPropertyChanged();
      }
      }

      public bool Verified
      {
      get => _verified;
      set
      {
      if (value == _verified) return;
      _verified = value;
      OnPropertyChanged();
      }
      }
      }


      I bind controls this way



      <TextBox Text="{Binding Path=Number.Value}" att:VerifiableControl.Verified="{Binding Path=Number.Verified}"
      BorderBrush="{Binding Path=(att:VerifiableControl.Verified), Mode=OneWay,
      Converter={StaticResource BackColorVerifiedConverter}}">
      <inter:Interaction.Triggers>
      <inter:EventTrigger EventName="LostFocus">
      <inter:InvokeCommandAction Command="{Binding Path=DataContext.VerifyCurrentFieldCommand, ElementName=Root}"
      CommandParameter="{Binding Path=Number}"/>
      </inter:EventTrigger>
      </inter:Interaction.Triggers>
      </TextBox>


      Generic value of Verifiable property object binds to text (or SelectedDate in case of DatePicker, etc.), border color binds to flag "Verified" via converter and also I bind interaction trigger for "FocusLost" event to ViewModel command that just set "Verified" flag of corresponding property object to true.



      I really don't like the idea I have to copypaste this block many times with little changes. I know, I cannot put intercation trigger in style and I also couldn't find another way to make some kind of short pattern for that.
      So, is there a way to create some kind of short pattern for this xaml code where I could customize name of property to bind? Or maybe you could suggest another approach for what I want ot achieve?










      share|improve this question













      I'm trying to achieve quite a specific thing in WPF. I need to create a verifiable control, which will be binded to object of generic class like this



      public interface IVerifiable
      {
      bool Verified { get; set; }
      }

      public class VerifiableProperty<T> : INotifyPropertyChanged, IVerifiable
      {
      private T _value;
      private bool _verified;

      public T Value
      {
      get => _value;
      set
      {
      if (Equals(value, _value)) return;
      _value = value;
      OnPropertyChanged();
      }
      }

      public bool Verified
      {
      get => _verified;
      set
      {
      if (value == _verified) return;
      _verified = value;
      OnPropertyChanged();
      }
      }
      }


      I bind controls this way



      <TextBox Text="{Binding Path=Number.Value}" att:VerifiableControl.Verified="{Binding Path=Number.Verified}"
      BorderBrush="{Binding Path=(att:VerifiableControl.Verified), Mode=OneWay,
      Converter={StaticResource BackColorVerifiedConverter}}">
      <inter:Interaction.Triggers>
      <inter:EventTrigger EventName="LostFocus">
      <inter:InvokeCommandAction Command="{Binding Path=DataContext.VerifyCurrentFieldCommand, ElementName=Root}"
      CommandParameter="{Binding Path=Number}"/>
      </inter:EventTrigger>
      </inter:Interaction.Triggers>
      </TextBox>


      Generic value of Verifiable property object binds to text (or SelectedDate in case of DatePicker, etc.), border color binds to flag "Verified" via converter and also I bind interaction trigger for "FocusLost" event to ViewModel command that just set "Verified" flag of corresponding property object to true.



      I really don't like the idea I have to copypaste this block many times with little changes. I know, I cannot put intercation trigger in style and I also couldn't find another way to make some kind of short pattern for that.
      So, is there a way to create some kind of short pattern for this xaml code where I could customize name of property to bind? Or maybe you could suggest another approach for what I want ot achieve?







      c# wpf xaml data-binding






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 12 at 3:24









      Andrey1661

      31




      31
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          Use some attached properties and attach in there to the LostFocus event.



          public static class VerifiableBehaviour
          {
          public static bool GetVerified(UIElement obj) => (bool)obj.GetValue(VerifiedProperty);
          public static void SetVerified(DependencyObject obj, bool value) => obj.SetValue(VerifiedProperty, value);

          public static readonly DependencyProperty VerifiedProperty = DependencyProperty.RegisterAttached(
          "Verified", typeof(bool), typeof(VerifiableBehaviour),
          new FrameworkPropertyMetadata(false)
          {
          BindsTwoWayByDefault = true,
          DefaultUpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
          });

          public static bool GetTracking(UIElement obj) => (bool)obj.GetValue(TrackingProperty);
          public static void SetTracking(UIElement obj, bool value) => obj.SetValue(TrackingProperty, value);

          public static readonly DependencyProperty TrackingProperty = DependencyProperty.RegisterAttached(
          "Tracking", typeof(bool), typeof(VerifiableBehaviour),
          new PropertyMetadata(false, Tracking_PropertyChanged));

          private static void Tracking_PropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
          {
          UIElement element = d as UIElement;

          if ((bool)e.NewValue)
          element.LostFocus += Element_LostFocus;
          else
          element.LostFocus -= Element_LostFocus;
          }

          private static void Element_LostFocus(object sender, RoutedEventArgs e)
          {
          UIElement element = sender as UIElement;
          SetVerified(element, true);
          }
          }


          and bind it to your controls



          <StackPanel>
          <StackPanel.Resources>
          <DataTemplate x:Key="VerifiableText">
          <StackPanel>
          <TextBox b:VerifiableBehaviour.Tracking="True"
          b:VerifiableBehaviour.Verified="{Binding Verified}"
          Text="{Binding Value}"/>
          <TextBlock>(Verified: <Run Text="{Binding Verified}"/>)</TextBlock>
          </StackPanel>
          </DataTemplate>
          </StackPanel.Resources>

          <TextBlock Text="MyProperty1"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty1}" IsTabStop="False"/>
          <Separator/>
          <TextBlock Text="MyProperty2"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty2}" IsTabStop="False"/>
          <Separator/>
          <TextBlock Text="MyProperty3"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty3}" IsTabStop="False"/>
          <Separator/>
          <TextBlock Text="MyProperty4"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty4}" IsTabStop="False"/>
          <Separator/>
          </StackPanel>





          share|improve this answer





















          • Got the idea, thank you. Didn't try data template for that. So, I guess, I need to provide a data template for each type of control I want to use
            – Andrey1661
            Nov 12 at 8:55











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53255570%2frepeatable-pattern-in-wpf%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          Use some attached properties and attach in there to the LostFocus event.



          public static class VerifiableBehaviour
          {
          public static bool GetVerified(UIElement obj) => (bool)obj.GetValue(VerifiedProperty);
          public static void SetVerified(DependencyObject obj, bool value) => obj.SetValue(VerifiedProperty, value);

          public static readonly DependencyProperty VerifiedProperty = DependencyProperty.RegisterAttached(
          "Verified", typeof(bool), typeof(VerifiableBehaviour),
          new FrameworkPropertyMetadata(false)
          {
          BindsTwoWayByDefault = true,
          DefaultUpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
          });

          public static bool GetTracking(UIElement obj) => (bool)obj.GetValue(TrackingProperty);
          public static void SetTracking(UIElement obj, bool value) => obj.SetValue(TrackingProperty, value);

          public static readonly DependencyProperty TrackingProperty = DependencyProperty.RegisterAttached(
          "Tracking", typeof(bool), typeof(VerifiableBehaviour),
          new PropertyMetadata(false, Tracking_PropertyChanged));

          private static void Tracking_PropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
          {
          UIElement element = d as UIElement;

          if ((bool)e.NewValue)
          element.LostFocus += Element_LostFocus;
          else
          element.LostFocus -= Element_LostFocus;
          }

          private static void Element_LostFocus(object sender, RoutedEventArgs e)
          {
          UIElement element = sender as UIElement;
          SetVerified(element, true);
          }
          }


          and bind it to your controls



          <StackPanel>
          <StackPanel.Resources>
          <DataTemplate x:Key="VerifiableText">
          <StackPanel>
          <TextBox b:VerifiableBehaviour.Tracking="True"
          b:VerifiableBehaviour.Verified="{Binding Verified}"
          Text="{Binding Value}"/>
          <TextBlock>(Verified: <Run Text="{Binding Verified}"/>)</TextBlock>
          </StackPanel>
          </DataTemplate>
          </StackPanel.Resources>

          <TextBlock Text="MyProperty1"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty1}" IsTabStop="False"/>
          <Separator/>
          <TextBlock Text="MyProperty2"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty2}" IsTabStop="False"/>
          <Separator/>
          <TextBlock Text="MyProperty3"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty3}" IsTabStop="False"/>
          <Separator/>
          <TextBlock Text="MyProperty4"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty4}" IsTabStop="False"/>
          <Separator/>
          </StackPanel>





          share|improve this answer





















          • Got the idea, thank you. Didn't try data template for that. So, I guess, I need to provide a data template for each type of control I want to use
            – Andrey1661
            Nov 12 at 8:55















          up vote
          1
          down vote



          accepted










          Use some attached properties and attach in there to the LostFocus event.



          public static class VerifiableBehaviour
          {
          public static bool GetVerified(UIElement obj) => (bool)obj.GetValue(VerifiedProperty);
          public static void SetVerified(DependencyObject obj, bool value) => obj.SetValue(VerifiedProperty, value);

          public static readonly DependencyProperty VerifiedProperty = DependencyProperty.RegisterAttached(
          "Verified", typeof(bool), typeof(VerifiableBehaviour),
          new FrameworkPropertyMetadata(false)
          {
          BindsTwoWayByDefault = true,
          DefaultUpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
          });

          public static bool GetTracking(UIElement obj) => (bool)obj.GetValue(TrackingProperty);
          public static void SetTracking(UIElement obj, bool value) => obj.SetValue(TrackingProperty, value);

          public static readonly DependencyProperty TrackingProperty = DependencyProperty.RegisterAttached(
          "Tracking", typeof(bool), typeof(VerifiableBehaviour),
          new PropertyMetadata(false, Tracking_PropertyChanged));

          private static void Tracking_PropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
          {
          UIElement element = d as UIElement;

          if ((bool)e.NewValue)
          element.LostFocus += Element_LostFocus;
          else
          element.LostFocus -= Element_LostFocus;
          }

          private static void Element_LostFocus(object sender, RoutedEventArgs e)
          {
          UIElement element = sender as UIElement;
          SetVerified(element, true);
          }
          }


          and bind it to your controls



          <StackPanel>
          <StackPanel.Resources>
          <DataTemplate x:Key="VerifiableText">
          <StackPanel>
          <TextBox b:VerifiableBehaviour.Tracking="True"
          b:VerifiableBehaviour.Verified="{Binding Verified}"
          Text="{Binding Value}"/>
          <TextBlock>(Verified: <Run Text="{Binding Verified}"/>)</TextBlock>
          </StackPanel>
          </DataTemplate>
          </StackPanel.Resources>

          <TextBlock Text="MyProperty1"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty1}" IsTabStop="False"/>
          <Separator/>
          <TextBlock Text="MyProperty2"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty2}" IsTabStop="False"/>
          <Separator/>
          <TextBlock Text="MyProperty3"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty3}" IsTabStop="False"/>
          <Separator/>
          <TextBlock Text="MyProperty4"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty4}" IsTabStop="False"/>
          <Separator/>
          </StackPanel>





          share|improve this answer





















          • Got the idea, thank you. Didn't try data template for that. So, I guess, I need to provide a data template for each type of control I want to use
            – Andrey1661
            Nov 12 at 8:55













          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          Use some attached properties and attach in there to the LostFocus event.



          public static class VerifiableBehaviour
          {
          public static bool GetVerified(UIElement obj) => (bool)obj.GetValue(VerifiedProperty);
          public static void SetVerified(DependencyObject obj, bool value) => obj.SetValue(VerifiedProperty, value);

          public static readonly DependencyProperty VerifiedProperty = DependencyProperty.RegisterAttached(
          "Verified", typeof(bool), typeof(VerifiableBehaviour),
          new FrameworkPropertyMetadata(false)
          {
          BindsTwoWayByDefault = true,
          DefaultUpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
          });

          public static bool GetTracking(UIElement obj) => (bool)obj.GetValue(TrackingProperty);
          public static void SetTracking(UIElement obj, bool value) => obj.SetValue(TrackingProperty, value);

          public static readonly DependencyProperty TrackingProperty = DependencyProperty.RegisterAttached(
          "Tracking", typeof(bool), typeof(VerifiableBehaviour),
          new PropertyMetadata(false, Tracking_PropertyChanged));

          private static void Tracking_PropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
          {
          UIElement element = d as UIElement;

          if ((bool)e.NewValue)
          element.LostFocus += Element_LostFocus;
          else
          element.LostFocus -= Element_LostFocus;
          }

          private static void Element_LostFocus(object sender, RoutedEventArgs e)
          {
          UIElement element = sender as UIElement;
          SetVerified(element, true);
          }
          }


          and bind it to your controls



          <StackPanel>
          <StackPanel.Resources>
          <DataTemplate x:Key="VerifiableText">
          <StackPanel>
          <TextBox b:VerifiableBehaviour.Tracking="True"
          b:VerifiableBehaviour.Verified="{Binding Verified}"
          Text="{Binding Value}"/>
          <TextBlock>(Verified: <Run Text="{Binding Verified}"/>)</TextBlock>
          </StackPanel>
          </DataTemplate>
          </StackPanel.Resources>

          <TextBlock Text="MyProperty1"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty1}" IsTabStop="False"/>
          <Separator/>
          <TextBlock Text="MyProperty2"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty2}" IsTabStop="False"/>
          <Separator/>
          <TextBlock Text="MyProperty3"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty3}" IsTabStop="False"/>
          <Separator/>
          <TextBlock Text="MyProperty4"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty4}" IsTabStop="False"/>
          <Separator/>
          </StackPanel>





          share|improve this answer












          Use some attached properties and attach in there to the LostFocus event.



          public static class VerifiableBehaviour
          {
          public static bool GetVerified(UIElement obj) => (bool)obj.GetValue(VerifiedProperty);
          public static void SetVerified(DependencyObject obj, bool value) => obj.SetValue(VerifiedProperty, value);

          public static readonly DependencyProperty VerifiedProperty = DependencyProperty.RegisterAttached(
          "Verified", typeof(bool), typeof(VerifiableBehaviour),
          new FrameworkPropertyMetadata(false)
          {
          BindsTwoWayByDefault = true,
          DefaultUpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
          });

          public static bool GetTracking(UIElement obj) => (bool)obj.GetValue(TrackingProperty);
          public static void SetTracking(UIElement obj, bool value) => obj.SetValue(TrackingProperty, value);

          public static readonly DependencyProperty TrackingProperty = DependencyProperty.RegisterAttached(
          "Tracking", typeof(bool), typeof(VerifiableBehaviour),
          new PropertyMetadata(false, Tracking_PropertyChanged));

          private static void Tracking_PropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
          {
          UIElement element = d as UIElement;

          if ((bool)e.NewValue)
          element.LostFocus += Element_LostFocus;
          else
          element.LostFocus -= Element_LostFocus;
          }

          private static void Element_LostFocus(object sender, RoutedEventArgs e)
          {
          UIElement element = sender as UIElement;
          SetVerified(element, true);
          }
          }


          and bind it to your controls



          <StackPanel>
          <StackPanel.Resources>
          <DataTemplate x:Key="VerifiableText">
          <StackPanel>
          <TextBox b:VerifiableBehaviour.Tracking="True"
          b:VerifiableBehaviour.Verified="{Binding Verified}"
          Text="{Binding Value}"/>
          <TextBlock>(Verified: <Run Text="{Binding Verified}"/>)</TextBlock>
          </StackPanel>
          </DataTemplate>
          </StackPanel.Resources>

          <TextBlock Text="MyProperty1"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty1}" IsTabStop="False"/>
          <Separator/>
          <TextBlock Text="MyProperty2"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty2}" IsTabStop="False"/>
          <Separator/>
          <TextBlock Text="MyProperty3"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty3}" IsTabStop="False"/>
          <Separator/>
          <TextBlock Text="MyProperty4"/>
          <ContentControl ContentTemplate="{StaticResource VerifiableText}"
          Content="{Binding MyProperty4}" IsTabStop="False"/>
          <Separator/>
          </StackPanel>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 12 at 8:04









          Sir Rufo

          14.3k22757




          14.3k22757












          • Got the idea, thank you. Didn't try data template for that. So, I guess, I need to provide a data template for each type of control I want to use
            – Andrey1661
            Nov 12 at 8:55


















          • Got the idea, thank you. Didn't try data template for that. So, I guess, I need to provide a data template for each type of control I want to use
            – Andrey1661
            Nov 12 at 8:55
















          Got the idea, thank you. Didn't try data template for that. So, I guess, I need to provide a data template for each type of control I want to use
          – Andrey1661
          Nov 12 at 8:55




          Got the idea, thank you. Didn't try data template for that. So, I guess, I need to provide a data template for each type of control I want to use
          – Andrey1661
          Nov 12 at 8:55


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53255570%2frepeatable-pattern-in-wpf%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to pass form data using jquery Ajax to insert data in database?

          National Museum of Racing and Hall of Fame

          Guess what letter conforming each word