คือผมลองเล่น WPF ดูอ่ะครับ แล้วทีนี้ผมเกิดความสงสัยแบบสุดๆครับว่า ในเมื่อโปรแกรมกับส่วนแสดงผลแยกกัน ทีนี้ถ้าเกิดว่าผมต้องการปรับค่าการแสดงผลจาก Main Program ได้นี่มันต้องทำอย่างไรหรอครับ เช่นใน xaml มี TextBlock สูง 200 แต่ผมต้องการที่จะเปลี่ยนค่าความกว้างของมันได้อย่างอิสระจากการคำนวณใน Main Program โดยป้อนค่าตัวเลขที่ต้องการลงใน textbox อะไรแบบนี้อ่ะครับ มันต้องทำยังไงหรอครับ..
Hiring! บริษัทที่น่าสนใจ
Carmen Software
Hotel Financial Solutions
Next Innovation (Thailand) Co., Ltd.
We are web design with consulting & engineering services driven the future stronger and flexibility.
KKP Dime
KKP Dime บริษัทในเครือเกียรตินาคินภัทร
Kiatnakin Phatra Financial Group
Financial Service
Fastwork Technologies
Fastwork.co เว็บไซต์ที่รวบรวม ฟรีแลนซ์ มืออาชีพจากหลากหลายสายงานไว้ในที่เดียวกัน
Thoughtworks Thailand
Thoughtworks เป็นบริษัทที่ปรึกษาด้านเทคโนโยลีระดับโลกที่คว้า Great Place to Work 3 ปีซ้อน
Iron Software
Iron Software is an American company providing a suite of .NET libraries by engineer for engineers.
CLEVERSE
Cleverse is a Venture Builder. Our team builds several tech companies.
Nipa Cloud
#1 OpenStack cloud provider in Thailand with our own data center and software platform.
Bangmod Enterprise
The leader in Cloud Server and Hosting in Thailand.
CIMB THAI Bank
MOVING FORWARD WITH YOU - CIMB is the leading ASEAN Bank
Bangkok Bank
Bangkok Bank is one of Southeast Asia's largest regional banks, a market leader in business banking
MuvMi (Urban Mobility Tech Co.,Ltd.)
Shape the future of urban mobility towards affordable, clean, and safe solutions
T.N. Digital Solution Co., Ltd.
TNDS has been involving in every first move of banking’s major digital transformation.
KBTG - KASIKORN Business-Technology Group
KBTG - "The Technology Company for Digital Business Innovation"
Siam Commercial Bank Public Company Limited
"Let's start a brighter career future together"
Icon Framework co.,Ltd.
Global Standard Platform for Real Estate แพลตฟอร์มสำหรับธุรกิจอสังหาริมทรัพย์ครบวงจร มาตรฐานระดับโลก
REFINITIV
The Financial and Risk business of Thomson Reuters is now Refinitiv
H LAB
Re-engineering healthcare systems through intelligent platforms and system design.
The Gang Technology Co., Ltd.
We're a Digital Agency that helps our customers transform their business into digital with ease.
LTMH
LTMH มุ่งเน้นการพัฒนาผลิตภัณฑ์ที่สามารถช่วยพันธมิตรของเราให้บรรลุเป้าหมาย
Seven Peaks
We Drive Digital Transformation
Wisesight (Thailand) Co., Ltd.
The Best Choice For Handling Social Media · High Expertise in Social Data · Most Advanced and Secure
MOLOG Tech
We are Modern Logistic Platform, Specialize in WMS, OMS and TMS.
Data Wow Co.,Ltd
We enable our clients to realize increased productivity by solving their most complex issues by Data
LINE Company Thailand
LINE, the world's hottest mobile messaging platform, offers free text and voice messaging + Call
LINE MAN Wongnai
Join our journey to becoming No.1 food platform in Thailand
ก็ Binding ตามปกติเลยครับ
varavut Mon, 28/05/2012 - 17:33
ก็ Binding ตามปกติเลยครับ แต่ถ้าจะให้มันเอาค่าจาก TextBox กลับไปด้วยต้องกำหนดเป็น TwoWay เพื่อบอกว่าค่าในนี้หากมีการกำหนดที่ UI ให้ไปแก้ค่าที่ DataContext ด้วย
เช่น
ปล. อันนี้ผมเขียนเป็นของ WP7 นะครับ ไม่รู้ว่าจะเหมือนกันไหม
คือตอนนี้ผม Binding เป็นแค่
livebox Mon, 28/05/2012 - 19:05
คือตอนนี้ผม Binding เป็นแค่ [กำหนด ElementName แล้วก็ Path ]ให้ชี้ค่าไปที่ ElementName นั้นๆใน xaml เองอ่ะครับ ทีนี้ผมก็เลยสงสัยว่า ถ้าเกิดจะให้มันชี้ไปเอาค่าใน mian program อ่ะครับ มันจะต้องทำยังไง
เช่นใน Windows ผมมี Button1 อยู่ปุ่มนึง แล้วก็มี TextBlock1 อยู่หนึ่งตัว สูง 200 แต่ความกว้างผมจะไปเอาที่ main program โดยที่ตอนที่โปรแกรมโหลดขึ้นมาผมกำหนดค่าเริ่มต้นให้ความกว้างของ TextBlock1 เป็น 100 แล้วคำสั่งภายในปุ่มผมคือกำหนดให้ความกว้างของ TextBlock1 นั้นเป็น 300 อะไรแบบนี้อ่ะครับ แบบว่าผมอยากจะทำแบบนี้อ่ะครับ ไม่ทราบว่าทำอย่างไร รบกวนช่วยลองเขียน Code xaml กับ C#หรือVB ให้ดูเป็นตัวอย่างหน่อยสิครับ ขอบคุณล่วงหน้าครับผม..
public partial class MainPage
varavut Mon, 28/05/2012 - 20:16
ใช้xaml ใน comment แรกนะครับ
เวลาจะเปลี่ยนค่าก็สั่งแค่ Width1 = ค่าที่ต้องการ มันก็จะ Binding เองเลยครับ
อันนี้เป็นของ WP7 แต่คิดว่าก็น่าจะคล้ายๆกัน
โว้วว ขอบคุณมากๆครับ
livebox Mon, 28/05/2012 - 22:54
In reply to public partial class MainPage by varavut
โว้วว ขอบคุณมากๆครับ แล้วถ้าเกิดจะเปลี่ยนแปลงค่าความกว้างของตัว Control ที่มันอยู่ใน DataTemplate มันจะต้องทำอย่างไรหรอครับ..
แล้วใช้วิธีเดียวกันนี้ไม่ได้ห
varavut Tue, 29/05/2012 - 15:34
In reply to โว้วว ขอบคุณมากๆครับ by livebox
แล้วใช้วิธีเดียวกันนี้ไม่ได้หรอครับ ผมก็ไม่เคยลองเหมือนกัน
ครับผม ผมลองดูแล้ว แบบว่า
livebox Tue, 29/05/2012 - 17:14
In reply to แล้วใช้วิธีเดียวกันนี้ไม่ได้ห by varavut
ครับผม ผมลองดูแล้ว แบบว่า ของที่อยู่ใน DataTemplate มันเชื่อมต่อไปไม่ถึง Width1 ได้เลยอ่ะครับ แต่มันสามารถ Binding ไปหา Element ข้างนอก DataTemplate ใน xaml ได้อ่ะครับ