WPF textblock events inside contentcontrol of a button not getting called -
i have simple button 2 textblock elements within contentcontrol tag of button under. problem textblock control's mouseup event not getting called. instead onclick even1t of button getting called every time click on textblock controls.
<button> <contentcontrol> <textblock x:name="txt1" text="tes1-1" mouseleftbuttonup="txt1_mouseleftbuttonup"/> <textblock x:name="txt2" text="tes1-1" mouseleftbuttonup="txt2_mouseleftbuttonup"/> <contentcontrol> </button>
if place contentcontrol tag outside <button>
tag, events work however.
it not way can start mouseleftbuttonup event handler textblocks, way how can handle mouseleftbuttonup event on textblocks:
<button mouse.previewmouseup="button_mouseleftbuttonup"> <contentcontrol> <textblock text="testtext" x:name="txt1"/> </contentcontrol> </button> private void button_mouseleftbuttonup(object sender, mousebuttoneventargs e) { var btn = sender button; if (btn == null) return; if (btn.inputhittest(e.getposition(btn)) textblock) { ;//textblock mouseup handler } }
Comments
Post a Comment